Form code - need help?!

P

p-rat

I am new and wanting to make changes to a form code. The programmer
is
no longer here. I need help. The form is for Truck Field Tickets. We
enter in data; if someone tries to enter in the same Field Ticket
number it comes back with a dialog box saying 'this ticket number
already exists'. If someone enters an incomplete ticket a dialog box
states 'the ticket is invalid'.

I'm needing to be able to add a universal type "SHOP TIME" ticket
that
our drivers can go in and input their down time on. So where the
unique Field Ticket number would go; I would like the capability of
the driver putting in SHOP TIME and then some other info to collect
this time. Of course more than one driver will be doing this on a
daily basis. I have truck number, date, and driver to differentiate.


Here is the current code and being a newbie it is a little hard for
me
to understand how I might be able to do this. Any help would be
greatly appreciated! Thanks.


Private Sub
dbo_Field_Ticket_Header_Field_Ticket_Number_BeforeUpdate(Cancel As
Integer)
Dim lngField_Ticket_Number As Long, strCriteria As String
If IsNumeric(Me.dbo_Field_Ticket_Header_Field_Ticket_Number) Then
lngField_Ticket_Number =
Me.dbo_Field_Ticket_Header_Field_Ticket_Number
strCriteria = "[Field_Ticket_Number] = " &
lngField_Ticket_Number
If SearchTableByCriteria("dbo_Field_Ticket_Header",
strCriteria) Then
MsgBox "That ticket number already exists in the
database.
Please enter another ticket number.", vbExclamation
Cancel = True
End If
Else
MsgBox "INVALID TICKET NUMBER.", vbExclamation
Cancel = True
End If


End Sub
 
R

ruralguy via AccessMonster.com

Please do not multi-post your question.
http://www.accessmonster.com/Uwe/Forum.aspx/access-forms/55307/help-with-form-code


p-rat said:
I am new and wanting to make changes to a form code. The programmer
is
no longer here. I need help. The form is for Truck Field Tickets. We
enter in data; if someone tries to enter in the same Field Ticket
number it comes back with a dialog box saying 'this ticket number
already exists'. If someone enters an incomplete ticket a dialog box
states 'the ticket is invalid'.

I'm needing to be able to add a universal type "SHOP TIME" ticket
that
our drivers can go in and input their down time on. So where the
unique Field Ticket number would go; I would like the capability of
the driver putting in SHOP TIME and then some other info to collect
this time. Of course more than one driver will be doing this on a
daily basis. I have truck number, date, and driver to differentiate.

Here is the current code and being a newbie it is a little hard for
me
to understand how I might be able to do this. Any help would be
greatly appreciated! Thanks.

Private Sub
dbo_Field_Ticket_Header_Field_Ticket_Number_BeforeUpdate(Cancel As
Integer)
Dim lngField_Ticket_Number As Long, strCriteria As String
If IsNumeric(Me.dbo_Field_Ticket_Header_Field_Ticket_Number) Then
lngField_Ticket_Number =
Me.dbo_Field_Ticket_Header_Field_Ticket_Number
strCriteria = "[Field_Ticket_Number] = " &
lngField_Ticket_Number
If SearchTableByCriteria("dbo_Field_Ticket_Header",
strCriteria) Then
MsgBox "That ticket number already exists in the
database.
Please enter another ticket number.", vbExclamation
Cancel = True
End If
Else
MsgBox "INVALID TICKET NUMBER.", vbExclamation
Cancel = True
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top