Hello Guru's of Access
I am totally green in Access, just trying to learn during my free time
I am trying to set focus the field, but unable to do can anyone help, where I am making mistake
Case1
I want to make ensure that unbound form make ensure the record is already exists yes or no, if yes, message "Already exists" and move back to same field
When i enter the duplicate value Message popup "Customer ID already Exists", and when i press OK button (with my assumption, curser move back to same text field, following message is appears
Run-time error '2108':
You must save the field before you execute the GoToControl action, the GotoControl method, or the SetFocus method
Message/searching is working but move back to same field is not working
Here what i wrote
Private sub txtcid_BeforeUpdate(Cancel As Integer)
If DCount ("[custid]", "[customerdetails]", "[custid]='" & me.txtcid & "'") > 0 Then
MsgBox "Customer ID already exists"
txtcid.setfocus - this highlighted line when i debug
else
MsgBox "Test Unsuccessful"
End if
End Sub
I am totally green in Access, just trying to learn during my free time
I am trying to set focus the field, but unable to do can anyone help, where I am making mistake
Case1
I want to make ensure that unbound form make ensure the record is already exists yes or no, if yes, message "Already exists" and move back to same field
When i enter the duplicate value Message popup "Customer ID already Exists", and when i press OK button (with my assumption, curser move back to same text field, following message is appears
Run-time error '2108':
You must save the field before you execute the GoToControl action, the GotoControl method, or the SetFocus method
Message/searching is working but move back to same field is not working
Here what i wrote
Private sub txtcid_BeforeUpdate(Cancel As Integer)
If DCount ("[custid]", "[customerdetails]", "[custid]='" & me.txtcid & "'") > 0 Then
MsgBox "Customer ID already exists"
txtcid.setfocus - this highlighted line when i debug
else
MsgBox "Test Unsuccessful"
End if
End Sub