vegemite
Registered User.
- Local time
- Tomorrow, 08:28
- Joined
- Aug 5, 2019
- Messages
- 64
Hey experts!
Im recycling code from another database I have where I ask the user to enter the project number they want to go to and it either goes to it or has an error message. The only difference is that the project number is a string in this new database (at least thats what I think the error is)...
Im asking the input box to return PrjNo
the table JobManagement has the ProjectNumber I want to match it to... I think it will just be something simple I cannot see for looking.....
Private Sub cmdGotoJob_Click()
'Runs the a query to prompt the user to type a Project Number
'If the Project Number does not exist a message box appears
On Error GoTo Handler
Dim PrjNo As String
PrjNo = InputBox("Type Project Number", "Search By Project Number")
If IsNull(DLookup("ProjectNumber", "tblJobManagement", _
"ProjectNumber = " & PrjNo & "")) Then
MsgBox "The specified Project Number does not exist.", vbExclamation, "Error!"
'DoCmd.Close
Else
DoCmd.OpenForm "frmJobManagement", acNormal, , "ProjectNumber = " & PrjNo
End If
Handler:
'Some Error message
If Err = 13 Then
Exit Sub
End If
End Sub
Im recycling code from another database I have where I ask the user to enter the project number they want to go to and it either goes to it or has an error message. The only difference is that the project number is a string in this new database (at least thats what I think the error is)...
Im asking the input box to return PrjNo
the table JobManagement has the ProjectNumber I want to match it to... I think it will just be something simple I cannot see for looking.....
Private Sub cmdGotoJob_Click()
'Runs the a query to prompt the user to type a Project Number
'If the Project Number does not exist a message box appears
On Error GoTo Handler
Dim PrjNo As String
PrjNo = InputBox("Type Project Number", "Search By Project Number")
If IsNull(DLookup("ProjectNumber", "tblJobManagement", _
"ProjectNumber = " & PrjNo & "")) Then
MsgBox "The specified Project Number does not exist.", vbExclamation, "Error!"
'DoCmd.Close
Else
DoCmd.OpenForm "frmJobManagement", acNormal, , "ProjectNumber = " & PrjNo
End If
Handler:
'Some Error message
If Err = 13 Then
Exit Sub
End If
End Sub