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!

Navigate from a record in 1 form to SAME record in another form 1

Status
Not open for further replies.

Ogart

Technical User
Mar 26, 2003
104
US
Situation:
->Query 1: Asks for user, which drives Form 1.
->Form 1: The records that USER "owns". It could be many. Form 1 is basically there to give a list of the records that they are working on. Sort of an open items list.
->Form 2: The main data entry form for the rest of the work.
ID: That's the field that I'm keying off of.

What I want to do is click on a record in Form 1, which then opens form 2 at the same record. Form 1 has a button by each record that will pick up the correct "ID". The code looks like this:
Dim IDNum As Integer
IDNum = Me.ID
MsgBox "You just selected number" & IDNum
DoCmd.OpenForm "fMain"

I need to have some flavor of DoCmd.FindRecord that gets to the record that has the same ID.

I'm not seeing it, though no doubt a real programmer will remember fondly a homework assignment as a Freshman CS student that is related.

Thanks in advance for the help.

Chris

 
How are ya Ogart . . . . .

Add the following code to the [blue]On Load Event[/blue] of Form2:
Code:
[blue]   Dim db As dao.Database, rst As dao.Recordset, frm As Form
   
   Set frm = Forms![purple][b]Form1Name[/b][/purple]
   Set db = CurrentDb()
   Set rst = Me.RecordsetClone
   
   rst.FindFirst "[purple][b]ID[/b][/purple] = " & frm!ID
   Me.Bookmark = rst.Bookmark

   Set frm = Nothing
   Set db = Nothing
   Set frm = Nothing[/blue]


Calvin.gif
See Ya! . . . . . .
 
Works like a charm. Thanks Ace!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top