Hi all
New to the forum, haven't used access in a lot of years and I'm struggling! Hoping someone can point me in the right direction.
I have two tables;
- 'Step List' stores product information, code, drawing number, description etc. The code is unique on each item.
- 'Daily Tester' is for entering QC test data that operators undertake during production.
I have created a form for the daily tester table where they select a part code via a combo box which is looked up from the step list table. It shows them part description etc to confirm they have selected the right part. However I want it to put drawing number into the 'daily tester' table not just look it up each time.
On the code combo box after update I have put the following code;
Private Sub Code_AfterUpdate()
'Code below adds drawing number into daily tester table once step code entered
Dim dwgno As String
Dim db As dao.Database
Dim rs As dao.Recordset
dwgno = DLookup("Drawingnumber", "Step List", "Code='" & [Code] & "'") 'gets the drawing number for the selected code on the daily tester form from the step list table
Set db = CurrentDb
Set rs = db.OpenRecordset("Daily Tester", dbOpenDynaset)
With rs
.Edit
.Fields("Drawing") = dwgno
.Update
End With
rs.Close
Me.Requery
DoCmd.GoToRecord , , acLast
End Sub
This works, it retrieves the correct drawing number from the step list table based on the code selected in the combo box. However, it only ever inserts this drawing number into the first line in the daily tester table regardless of which line you are working in. I need to get it to move down to the line I'm working on but can't seem to find a way around it.
Any advice or pointers of where to look would be appreciated!