Hi guys - I have a simple problem that has been nagging me for days on end. Here goes, I hope I can explain it:
I have a simple table called LastBatch - it has 2 fields and 3 records - field names are Type and BatchNum
Type LastBatch NH 400 LCD 345 FS 012
Type is a Two or three character name and the BatchNum is a 3 character number
All I am trying to do is lookup the type and find the value of BatchNum, add 1 to it and write it back to BatchNum for the next use
Example: FS is the type and BatchNum value is 012
when I click a radio button in the form I want it to update the table so that the value of NH becomes 13
I have gotten it to count without a problem but it always writes back to the first record in the table even though FS is record three
Here is my code:
Private Sub Option8_Click()
Dim NewBatch
Dim LastBatch1
NewBatch = DLookup("[BatchNum]", "LastBatch", "[Type] = 'NH'")
MsgBox NewBatch
LastBatch1 = NewBatch + 1
MsgBox LastBatch1
End Sub
Thanks for any suggestions in advance