Hello,
I have three tables in an access database. I am only showing the fields that have are in the code
I am trying to add the pieces from the onrl table and add onhand from the rl table.
The total of onrl![pieces] + rl![onhand] = analysis[on hand amount]
The one shown below is called ONRL.
Cust |
Sku |
Pieces |
31 |
283875 |
72 |
31 |
86944 |
96 |
31 |
93245 |
100 |
31 |
93245 |
100 |
2nd table is called Analysis
Store Number |
Master Sku Number |
on hand amount |
31 |
283875 |
86 |
31 |
86944 |
36 |
31 |
93245 |
387 |
|
|
|
3rd table is called RL
Location Id |
Metro Sku Number |
onhand |
31 |
283875 |
86 |
31 |
86944 |
36 |
31 |
93245 |
387 |
|
|
|
What I am trying to do will be shown below.
If rl![location id] = 514 Then
If rl![sku] = 10100 Then
k = 1
End If
End If
an.AddNew
an![store number] = rl![location id]
an![City] = rl![Location DESC]
an![State] = rl![State]
an![master sku number] = rl![Metro SKU Number]
an![Master SKU Description] = rl![Master SKU Description]
The above works correctly
Here is were the problem starts
Do While Not onrl.EOF '1635 rows of data in the onrl table
If an![store number] = onrl![cust] And an![master sku number] = onrl![sku number] Then
'first run of the code
'an![store number] = 31 and onrl![cust] = 31 'This is correct
'an![master sku number]=4276 and onrl![sku number] =283875
'second run of the code
'first line the same 31 This is correct
'an![master sku number]=10178 and onrl![sku number] =283875
'need to figure out how to get it to go to the next one. Stuck on 283875
an![on hand amount] = rl![onhand] + onrl![pieces] '
Else: an![on hand amount] = rl![onhand]
'an.Update
Exit Do
End If
onrl.MoveNext
Loop
I can see the correct numbers in the code(cursor over the code) 72+86=158
however I am unable to get it to go to the next one. What is wrong with my loop? Any suggestions would be greatly appreciated.
Ken
If you need a better explanation I can try to provide one.