I have some vba in the On Open event of a form, however, when the form is opened, the controls are locked up or frozen. Controls such as buttons are fine, but dropdown boxes, textboxes, etc are 'stuck'. I am able to click them, but the focus and cursor doesnt move to the control. Trying to open a dropdown doesnt engage the control, etc.
I have narrowed it down to the VBA setting the text/value of a textbox. If I comment the lines for changing the value, the form works as intended other than that function. Note that this same VBA code works without issue on another form.
Here is the code currently:
Dim OtherMax As Long
Dim MaterialsMax As Long
OtherMax = DMax("[PO Num]", "[All POs]")
MaterialsMax = DMax("[PO NUMBER]", "[MATERIAL PO DATASHEET]")
DoCmd.GoToRecord , , acNewRec
If IsNull(Me.PONum) Then
If MaterialsMax >= OtherMax Then
Me.PONum = MaterialsMax + 1
Else
Me.PONum = OtherMax + 1
End If
End If
What am I doing wrong to cause the controls to lock up?
Thanks in advance, Mike