New Job

renenger

Registered User.
Local time
Today, 07:42
Joined
Oct 25, 2002
Messages
117
I've been looking all over the forum for help on this. If I missed it, I apologize for repeating this question.

I have a database that tracks tickets in our company. I have frmShortageTicket that is based on tblShortage that users input the ticket information on. We could have serveral tickets per job code. The way I would like to set it up is, the user inputs the Job Code, I want the form to check tblJobCodeInformation and make sure that the jobcode is listed there. If it is not, I would like a message box to pop up and state "The job code you have entered is not listed. Would you like to add it?" and then have the jobcode information form pop up.

I am mainly having a hard time with the code to have the form check to see if that code exists.

Any help would be greatly appreciated.

Thanks
 
Try Dcount

Not sure I get it correctly but it seems to me that you are just wanting to do a count to see if the Job Code Exists. You could try something like.


If DCount("[JobCode]", "tblJobCodeInformation", "[JobCode] = [Forms]![frmShortageTicket]![txtJobCode]") Then
' Job code exists
Else
'Bit of code you want in to do the add
'MsgBox txtJobCode.Text & " doesn't exist"
End If

Hope that helps you
Think the format is
dcount("[field to be counted]","[Table or query field is based on]","[field for criteria] = 'Criteria'")

Steve
 

Users who are viewing this thread

Back
Top Bottom