Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to increment a field in a form when the number is used

Status
Not open for further replies.

lewie

Technical User
Joined
Jan 17, 2003
Messages
94
Location
US
I have 2 tables one btv with title tapetype and tapeid
one called type table with tapeid type and last#.
I have a form with title tapetype and tapeid fields. First i enter a title. then when i enter a tapetype i want it to generate a tapeid consisting of tapetype + last # so each tapetype will have its on set of unique numbers . Then i need to increment the last #.
I placed in the following code in the afterupdate event:
Private Sub tapetype_AfterUpdate()
If IsNull([tapetype]) Then

Else
MsgBox [type table]![Type]
If [tapetype] = [type table]![Type] Then
[btv table]![tapeid] = [type table]![Type] + [type table]![last #]
[type table]![last #] = [type table]![last #] + 1
End If
End If
End Sub

I get the right value in [tapetype] but it can't find the values in the table, [type table]![type].
Any help will be appreciated.
Thanks
Lewie
 
I changed the name of the table to master and ran it and it still does the same thing. I get all 4 type text boxes changing everytime the typex=rec![type] executes maybe i can send you my little program.
Thanks for your time.
lewie
 
Hmmm, does seem a bit weird. Send me the program - idministrator@hotmail.com - and I'll see if I can find what ever it is that isn't working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top