I have several "Event Procedures" in Microsoft Access that I need to convert.
For example, I have this "OnClick" event on a checkbox on a form that I need to convert. I presume it will go in the Before Save code area. But I have no idea about how to convert this from visual basic. Is there a converter like I see online for converting JavaScript to PHP? Any help would be appreciated!
Private Sub OnClickEvent_Click()
Dim K As Integer
If Me!Checkmark.Value = True Then
K = K + 1
Else
If K < 1 Then
K = 0
Else
K = K - 1
End If
End If
Me!Count.Value = K
End Sub
In nuBuilder, JavaScript is used for client-side scripting and PHP server-side. There might be VBA to JS converters out there (use Google)
Double-click the label of your checkbox to open the Object Properties Dialog. Then in the Tab Custom Code, add an event handler onchange with this code:
var K = 0; // is K initially 0?
if (this.checked) {
K = K + 1
} else {
if (K < 1) {
K = 0;
} else {
K = K - 1;
}
}
// Replace Count with your nuBuilder object ID.
$('#Count').val(K).change();
You do not have the required permissions to view the files attached to this post.
Just so you know. All of the AS BS BB and BE code blocks are for PHP only and are executed on the server-side. You can create and call a Javascript routine (nuJavascriptCallback($string1) ) building it in the PHP and these code blocks if you need to. All Javascript to run on the client side should be done in the "Custom Code" of the object (most likely for the onclick that you're trying to do). Each field or label on the form has a Custom Code (click the OBJ button to see all the objects on your form) and so does the form itself (click the Prop button).
Getting clearer as I go! My limited (self and Google taught + one VB course back in the day) experience is all VBA / ASP and thus server-side. I have always been scared of JS stuff.
Got your code to work with a few tweaks. For example k = 1, k+1 got me 11 until I discovered Number(k) + 1 = 2
Those links you included are going on my desktop! (Especially the code library.)