help with form code

  • Thread starter Thread starter p-rat
  • Start date Start date
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
 
Not sure what you want to do when 'SHOP TIME' is entered but I have edited
your code below to show you where it goes.

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
If Me.dbo_Field_Ticket_Header_Field_Ticket_Number = "SHOP TIME"
Then
' Code to process SHOP TIME goes here
Else
 
Back
Top