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

setting a record equal to previous forms record

Status
Not open for further replies.

BenTitus

Programmer
Jan 16, 2003
61
0
0
US
Hello i have two forms, one is titled Question1 and the other is titled Question2. In question1 there is a textbox called text26 where the user enters the employee name. What i want is when i open question2 to have the record entered in text26 to automatically be place in EMP_NAME on Question2. My code currently looks like this:

stDocName = "Question2"

stLinkCriteria = "[Emp_Name]=" & "'" & Me![Text26] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

If you have any suggestions i would appriciate it
Thanks in advance
 
in the On Load event of Question2 enter this code...

Me.Emp_Name.value = Forms!Question1.Text26.value

If you are entering multiple records on Question2 the On Current event may work better.

hope this helps....
 
cghoga's approach is sound. If you want the first form to vanish when the second one appears, you can just use a macro to manage the transition. The macro would open form two then close form one. Since both forms will BRIEFLY be open at the same time, the handoff can occur.

Having said that, you should know that there is an alternative approach. You could just have one form. Based on certain conditions, you could make different objects on the form visible or invisible. This would cut down on the number of forms that you must manage, and the user's experience would be almost identical.
 
thanks for the help. Yeah i was using a macro on a time interval to close the form.
 
You don't need a time interval. Just open question2 before you close question1 (in your macro). The handoff will occur in the brief time before question1 closes. To the user, it will appear that question1 closed before question2 opened. Luckily for us, human vision is just not very good.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top