I apologize for my current lack of knowledge and hope that someone will be kind enough to give me some additional help.I posted a question regarding "Record does not exist, open add record form". I have managed (with the help of ADezii) to have the add new user form open up if there is no matching userID record in the TBLUser (BTW Userid is text) however even if the user does exist the add new user form opens up. I think I need an "Else" statement "telling" the DB that if the user exists, just go to the next field. Here is the code I have that seems to work:
I think the Else statement should be something like:
But I can't get it to work.
Many Many thanks for your help and patience with a newbie!!Robert
Code:
Private Sub Command118_Click()
'Create var.Dim intChk As Integer
'This line counts the number of rec instances in TBLUser.
intChk = DCount("*", "TBLUser", "[UserID]" = "'" & Forms!FrmCreateNewLaptopProfileForBookings!UserID & "'")
'Does the rec exist? If not then open FRMCreateNewUserWhileBooking to add the new user details.
If intChk = 0 Then 'No?
DoCmd.OpenForm "FRMCreateNewUserWhileBooking", , , , acFormAdd
End If
End Sub
Code:
Else If intChk > 0 Then SetFocus Me!Barcode
Many Many thanks for your help and patience with a newbie!!Robert
Comment