D
David
I have a continous form that generates routes for drivers. The fields
include:
Driver, Truck, Route1, Route2,..., Route12
I am trying to run code to assign ticket numbers each time a route is
assigned to a driver. Here is the code I am running. When I manuever
between fields trying to assign orders to the route combos I get this error.
Write Conflict
This record has been changed by another user since you started editing it.
If you save the record, you will overwrite the changes the other user
made......
Any ideas?
Private Sub Route1Combo_Click()
Dim ticketnum As String
ticketnum = Nz(DLookup("[ticket1]", "routes", "[autonumber]=[routenum]"),
"0")
If ticketnum = 0 Then
DoCmd.RunSQL ("INSERT INTO Tickets (Ordernumber)SELECT
[Forms]![RouteGenerationFrm]![route1combo] AS Expr1;")
ticketnum = DMax("[ticketnumber]", "tickets")
hiddentick.Value = ticketnum
DoCmd.RunSQL ("UPDATE Routes SET Routes.ticket1 =
[Forms]![RouteGenerationFrm]![hiddentick] WHERE
(((Routes.AutoNumber)=[Forms]![RouteGenerationFrm]![routenum]));")
End If
End Sub
Private Sub Route2Combo_Click()
Dim ticketnum As String
ticketnum = Nz(DLookup("[ticket2]", "routes", "[autonumber]=[routenum]"),
"0")
If ticketnum = 0 Then
DoCmd.RunSQL ("INSERT INTO Tickets (Ordernumber)SELECT
[Forms]![RouteGenerationFrm]![route2combo] AS Expr1;")
ticketnum = DMax("[ticketnumber]", "tickets")
hiddentick.Value = ticketnum
DoCmd.RunSQL ("UPDATE Routes SET Routes.ticket2 =
[Forms]![RouteGenerationFrm]![hiddentick] WHERE
(((Routes.AutoNumber)=[Forms]![RouteGenerationFrm]![routenum]));")
End If
End Sub
include:
Driver, Truck, Route1, Route2,..., Route12
I am trying to run code to assign ticket numbers each time a route is
assigned to a driver. Here is the code I am running. When I manuever
between fields trying to assign orders to the route combos I get this error.
Write Conflict
This record has been changed by another user since you started editing it.
If you save the record, you will overwrite the changes the other user
made......
Any ideas?
Private Sub Route1Combo_Click()
Dim ticketnum As String
ticketnum = Nz(DLookup("[ticket1]", "routes", "[autonumber]=[routenum]"),
"0")
If ticketnum = 0 Then
DoCmd.RunSQL ("INSERT INTO Tickets (Ordernumber)SELECT
[Forms]![RouteGenerationFrm]![route1combo] AS Expr1;")
ticketnum = DMax("[ticketnumber]", "tickets")
hiddentick.Value = ticketnum
DoCmd.RunSQL ("UPDATE Routes SET Routes.ticket1 =
[Forms]![RouteGenerationFrm]![hiddentick] WHERE
(((Routes.AutoNumber)=[Forms]![RouteGenerationFrm]![routenum]));")
End If
End Sub
Private Sub Route2Combo_Click()
Dim ticketnum As String
ticketnum = Nz(DLookup("[ticket2]", "routes", "[autonumber]=[routenum]"),
"0")
If ticketnum = 0 Then
DoCmd.RunSQL ("INSERT INTO Tickets (Ordernumber)SELECT
[Forms]![RouteGenerationFrm]![route2combo] AS Expr1;")
ticketnum = DMax("[ticketnumber]", "tickets")
hiddentick.Value = ticketnum
DoCmd.RunSQL ("UPDATE Routes SET Routes.ticket2 =
[Forms]![RouteGenerationFrm]![hiddentick] WHERE
(((Routes.AutoNumber)=[Forms]![RouteGenerationFrm]![routenum]));")
End If
End Sub