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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP WITH NUMBERS

Status
Not open for further replies.

csegal

Technical User
Jun 12, 2001
38
US
Hi People!
I have a simple form where I have to enter the date, a part number, a description and an "Asset #"
This is a two part question.
1). When the form is opened up, I want to open to an new record and have the date field be automatic with the current date.

2). The "Asset#" field be the next number in sequence ie...
7607, 7608, 7609 etc for each new record should have the next number in sequence.

There are currently 3400 records in this data base.

PS...Please try to keep it ("code") simple.

Please help!
csegal@arrowair.com
 
{F1} topic = autonumber

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Okay Let's Go,

place this code under on form_Current

Me.Asset# = DMax("[Asset#]", "Table Name") + 1

Good Luck

" Åä Çááå íÍÈ ÅÐÇ Úãá ÃÍÏßã ÚãáÇ Ãä íÊÞäå "
 
Hello HNA
I had inserted this code under the on form_Current:
Me.Asset# = DMax("[Asset#]", "Table Name") + 1

And i substituted the "Table Name" with the name of the table where the data is from "SERIAL NUMBER LOG"
But i get a COMPILE ERROR "Method or data member not found"
then it highlights the .Asset# =

Need more help please...
csegal@arrowair.com
 
Hi Csegal,

I Belive that u copy and past this code without change to correct Field Name, Please Note:

What Is Asset# Field Name In your Table, Put It Instead Of me.Asset# for example me.blablabla

Me.blablabla= DMax("[blablabla]", "Table Name") + 1

I Hope It's Clear

Good Luck

" Åä Çááå íÍÈ ÅÐÇ Úãá ÃÍÏßã ÚãáÇ Ãä íÊÞäå "
 
Well it sort of works except when any other field is clicked, the asset number increases by 1???
The code was entered in the Form "On Current" [Event Procedure]code area as follows...

Me.Asset = DMax("[Asset]", "SERIAL NUMBER LOG") + 1

This is getting very perplexing, I even tried to
create a temporary table with the number starting at 1 less then where I wanted to start.
Then created and ran an append query...according to the auto number help screen.
But I think I got lost somewhere??? I dont know.

If anyone can help, please do.
 
I TRIED THE FOLLOWING CODE WITH NO RESULTS ALSO

If IsNull(Asset) Then
Me.Asset = DMax("[Asset]", "SERIAL NUMBER LOG") + 1
End If
 
I GOT IT!!!!!

Private Sub Form_Current()
If NewRecord() Then Me.Asset = DMax("[Asset]", "SERIAL NUMBER LOG") + 1

End Sub

THIS WORKS JUST GREAT!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top