Need help populating some fields on a new form when loaded

Dave 14867

Registered User.
Local time
Yesterday, 19:31
Joined
Jan 1, 2017
Messages
56
Hello,
I want to have 2 field populated when a form loads, the first is a field named NUM_ which I want to have a value of 1 more than the same field in the previous record, then I want another field to use that data in a string to populate a field named Book_Num in that record.

I want to have this done as the form loads so those 2 fields are already populated when the form is visible.

Any help is greatly appreciated.

Thanks

Dave
 
This could probably be done in the form load event using Dmax or DLookup but to get you specifics we need to know more.

I want to have 2 field populated when a form loads, the first is a field named NUM_ which I want to have a value of 1 more than the same field in the previous record,

Previous record in what table and what would determine if the record was the previous record?

then I want another field to use that data in a string to populate a field named Book_Num in that record.

Is Book_Num the name of the textbox or combo box on the form? What do you mean by data in a string? A string literal?

Maybe it would help if you gave us an example of the form loading and what would need to happen step by step. Imagine you were doing this with pencil and paper.
 
A recordset has an .AbsolutePosition property. You might be able to use that if you want a sequential number in a form.
Code:
private sub Form_Current()
   debug.print "this is rec #: " & me.recordset.absoluteposition + 1
end sub
 
Hello all,

I have got this resolved and working perfectly, thanks for the input.

You folks are great, and it is great to get many ways of achieving the desired results, it help other like me understand things better and then select a method that best suits our needs, and helps prevent issues with the database.

Thank you

Dave
 
One word of caution: If this is being used in a multi-user environment, after populating the Control that holds NUM_ you need to immediately save the Record! Not doing so could easily result in the same number being generated/assigned for multiple Records, if two or more users are simultaneously entering Records.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom