RobertIngles
Technical User
I am experiencing weird cursor behaviour when I am writing code in Microsoft Access.
I am writing code for an unbound field BeforeUpdate. I have written most of the code which searches for a matching valuein a table - if the match exists the user gets an error messaging informs them of the match and prompts them to enter a unique value(this performs properly). I am now adding a line that clears the input field when they close the warning msgbox.
Here's where it gets weird;
I am adding the line Me.Undo
When I type Me. the VBA help box appears for a moment and then disappears immediately before I can select "Undo". If I finish the line to ready Me.Undo the Undo does not happen. I tried to enter the line Barcode=" but immediatley the line changes to Barcode="" and my cursor is sitting in front of the two quotation marks.
I have searched for a cause and solution but every answer I found was asking if the form is using a timer (mine doesn't) or if the laptop microphone is active (I don't have one) as apparently these can be the causes of odd cursor/code insertion behaviour.
Can any one help?
'Create var.
Dim intChk As Integer
'This line counts the number of rec instances in TBLLaptop.
intChk = DCount("*", "TBLlaptop", "[Barcode] = '" & Forms!FRM_Create_New_Laptop_Profile_To_Relplace_Refresh!LaptopBarCode & "'")
'Does the rec exist? If not then Move to field Barcode.
If intChk > 0 Then
MsgBox "This LaptopID Already Exists Please Insert a Unique Barcode", vbOK
Cancel = True
Me.Undo
Else
Barcode = LaptopBarCode
End If
Thanks
Robert
I am writing code for an unbound field BeforeUpdate. I have written most of the code which searches for a matching valuein a table - if the match exists the user gets an error messaging informs them of the match and prompts them to enter a unique value(this performs properly). I am now adding a line that clears the input field when they close the warning msgbox.
Here's where it gets weird;
I am adding the line Me.Undo
When I type Me. the VBA help box appears for a moment and then disappears immediately before I can select "Undo". If I finish the line to ready Me.Undo the Undo does not happen. I tried to enter the line Barcode=" but immediatley the line changes to Barcode="" and my cursor is sitting in front of the two quotation marks.
I have searched for a cause and solution but every answer I found was asking if the form is using a timer (mine doesn't) or if the laptop microphone is active (I don't have one) as apparently these can be the causes of odd cursor/code insertion behaviour.
Can any one help?
'Create var.
Dim intChk As Integer
'This line counts the number of rec instances in TBLLaptop.
intChk = DCount("*", "TBLlaptop", "[Barcode] = '" & Forms!FRM_Create_New_Laptop_Profile_To_Relplace_Refresh!LaptopBarCode & "'")
'Does the rec exist? If not then Move to field Barcode.
If intChk > 0 Then
MsgBox "This LaptopID Already Exists Please Insert a Unique Barcode", vbOK
Cancel = True
Me.Undo
Else
Barcode = LaptopBarCode
End If
Thanks
Robert