RobertIngles
Technical User
I have a situation where my users need to enter details about new laptops into a table via FRMCreateNewLaptopID - the FRMCreateNewLaptopID includes a UserID field to identify the primary user.
They want to enter data into the UserID field in FRMCreateNewLaptopIDand click a confirmation button to see if the user does not exist then FRMCreateNewUserWhileBooking should open so they can enter the new user details which will be pushed to the FRMCreateNewLaptopID.
I have cobbled together the following code to open the user form in add mode however i get "Run time error 2428 you entered an invalid argumentin a domain agregate function.
What am I doing wrong?
Private Sub Command118_Click()
'Create var.
Dim intChk As Integer
'This line counts the number of rec instances in TBLUser.
intChk = DCount(UserID, TBLUser, FK = 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 "CreateNewUserWhileBooking", , , , acFormAdd
Else 'Yes? Open the existing record in edit mode to check if updates are required
DoCmd.OpenForm FRMEditUser, , , "UserID = " & FrmCreateLaptopProfileForBookings!UserID
End If
End Sub
They want to enter data into the UserID field in FRMCreateNewLaptopIDand click a confirmation button to see if the user does not exist then FRMCreateNewUserWhileBooking should open so they can enter the new user details which will be pushed to the FRMCreateNewLaptopID.
I have cobbled together the following code to open the user form in add mode however i get "Run time error 2428 you entered an invalid argumentin a domain agregate function.
What am I doing wrong?
Private Sub Command118_Click()
'Create var.
Dim intChk As Integer
'This line counts the number of rec instances in TBLUser.
intChk = DCount(UserID, TBLUser, FK = 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 "CreateNewUserWhileBooking", , , , acFormAdd
Else 'Yes? Open the existing record in edit mode to check if updates are required
DoCmd.OpenForm FRMEditUser, , , "UserID = " & FrmCreateLaptopProfileForBookings!UserID
End If
End Sub