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!

Last record

Status
Not open for further replies.

frodeb

Programmer
Jan 9, 2004
10
NO
In my form i have 10 record (lookup from table). When the user have enter the last informasion in the last record. I would like (by a macro) the form to close and upen another form. How can i make this happend?

Form: members
(locked) locked)
member_no, Name, age
1 bob 34
and so on
10 lisa 26 (this is the last record,
when the user is done entering age,
the form closes and another form open)
 
In you age textbox after update event add this code.

if me.member=10 then
docmd.close acform,"YourFormName"
docmd.openform "YourOtherFormName"
end if



This is assuming that your data in the member text box is formatted as a number not text. If it is text add quotes to the 10.

HTH,
Eric
 
Thank you for replaying!

How many memers the form has is not alwas 10 sometimes it can be 9 or 20 it depend on how many the users chooses (or filer out). I was thinking of when the new record had focus a macro was run ( i tryed useing IsNull=[member_no] close form, but that diden`t work. Any ide?
 
The easiest way would be to add a button to the form that the users would click when they are done. Otherwise you will have to prompt them when the form opens for the number of records that they intend on entering.

HTH,
Eric
 
I recommend taking luceze's suggestion. For one thing, it's easier to code, and much less prone to bugs.

Another thing to consider is that there's no guarentee that a user will enter data in any particular order. Most likely your form is designed well enough that there is an order that is obvious, but that isn't enough to ensure that the user follows that order. What happens if a user doesn't know what to enter for a particular field, and so decides to finish filling out all the other fields before looking up the missing one? Situations like this might be rare, but your program should account for them.

Also, users tend to get nervous when things start opening and closing for no apparent reason. They'll feel much better if you give them the control that luceze's solution offers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top