D
Design by Sue
I am getting a message that states "This record has been changed by another
user since you started editing it..." I am the only user and believe I am
only making one change. To try to set the stage:
I am trying to create a form where the user can select a PartNumber-Suffix
combintation from the table, see where the Part currently is (Line) and
reassign it to another line.
I have a table, PartSuffixTbl in which there are fields PartNumber, Suffix,
and Line. I have created a query (Part-SuffixQuery) which has all of these
fields in it plus one to combine the PartNumber and Suffix with a dash
between them so they read in one field. In the Line field I have created a
Criteria to filter by a number in a field on the form (LineNumber - more
about this to follow). Now on my form I have a combo box showing the
combined PartNumber-Suffix field plus the PartNumber and Suffix fields as
hidden. I then have a text box to display the current Line which is linked
to the combo box just mentioned. I then have an unbound combo box
(LineNumber) linked to the table that lists all available line numbers
(LineTbl). I have another text box IDisplay) that uses the query
(Part-SuffixQuery) and the criteria in the line field to display all parts
that are currently assigned to a given line.
The way it works, the user selects a PartNumber-Suffix and the linked test
box shows where the part currently is. The use then enters a number in the
LineNumber box and clicks a button to change the line number to the one
entered in the LineNumber box. This also refreshes the from and displays all
parts assigned to the line shown in the LineNumber box in the Display text
box.
The code in the OnClick of the button is:
Private Sub UpdateRecordBtn_Click()
On Error GoTo Err_UpdateRecordBtn_Click
Dim SQL As String
SQL = "UPDATE [PartSuffixTbl] " & _
"SET [Line] = Forms![LocationFrm3]![LineNumber] " & _
"WHERE PartNumber = Forms![LocationFrm3]![PartNumber] and " & _
"Suffix = Forms![LocationFrm3]![Suffix]"
DoCmd.RunSQL SQL
Me.refresh
Exit_UpdateRecordBtn_Click:
Exit Sub
Err_UpdateRecordBtn_Click:
MsgBox Err.Description
Resume Exit_UpdateRecordBtn_Click
End Sub
Now for the problem. All works but I get an error message stating This
record has been changed by another user since you started editing it..." CAn
anyone tell from my lengthy (sorry) explination what is causing this error.
I am thinking it is because I am using the same query for the PartNumber/Line
fields and for the Display text box. Any thoughts greatly appreciated.
Sue
user since you started editing it..." I am the only user and believe I am
only making one change. To try to set the stage:
I am trying to create a form where the user can select a PartNumber-Suffix
combintation from the table, see where the Part currently is (Line) and
reassign it to another line.
I have a table, PartSuffixTbl in which there are fields PartNumber, Suffix,
and Line. I have created a query (Part-SuffixQuery) which has all of these
fields in it plus one to combine the PartNumber and Suffix with a dash
between them so they read in one field. In the Line field I have created a
Criteria to filter by a number in a field on the form (LineNumber - more
about this to follow). Now on my form I have a combo box showing the
combined PartNumber-Suffix field plus the PartNumber and Suffix fields as
hidden. I then have a text box to display the current Line which is linked
to the combo box just mentioned. I then have an unbound combo box
(LineNumber) linked to the table that lists all available line numbers
(LineTbl). I have another text box IDisplay) that uses the query
(Part-SuffixQuery) and the criteria in the line field to display all parts
that are currently assigned to a given line.
The way it works, the user selects a PartNumber-Suffix and the linked test
box shows where the part currently is. The use then enters a number in the
LineNumber box and clicks a button to change the line number to the one
entered in the LineNumber box. This also refreshes the from and displays all
parts assigned to the line shown in the LineNumber box in the Display text
box.
The code in the OnClick of the button is:
Private Sub UpdateRecordBtn_Click()
On Error GoTo Err_UpdateRecordBtn_Click
Dim SQL As String
SQL = "UPDATE [PartSuffixTbl] " & _
"SET [Line] = Forms![LocationFrm3]![LineNumber] " & _
"WHERE PartNumber = Forms![LocationFrm3]![PartNumber] and " & _
"Suffix = Forms![LocationFrm3]![Suffix]"
DoCmd.RunSQL SQL
Me.refresh
Exit_UpdateRecordBtn_Click:
Exit Sub
Err_UpdateRecordBtn_Click:
MsgBox Err.Description
Resume Exit_UpdateRecordBtn_Click
End Sub
Now for the problem. All works but I get an error message stating This
record has been changed by another user since you started editing it..." CAn
anyone tell from my lengthy (sorry) explination what is causing this error.
I am thinking it is because I am using the same query for the PartNumber/Line
fields and for the Display text box. Any thoughts greatly appreciated.
Sue