Selected Record on switch to another form

  • Thread starter Thread starter DarenZ
  • Start date Start date
D

DarenZ

With a form open, I want to double click on a field to open another form and
modify the contents of that record. Currently I have the following

Private Sub Stock_Number_DblClick(Cancel As Integer)
DoCmd.OpenForm ("Magnify")
Form_Current (Form.Name)

and

Private Sub Form_Current()
Stock_Number.SetFocus

What I want is the second form to open with the focus on the record I double
clicked on. What am I missing?
 
What I want is the second form to open with the focus on the record I double
clicked on. What am I missing?

Daren,

You have to tell the form your opening what record you want it to
display.

Here's the way I normally do it.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Magnify"

stLinkCriteria = "[linking field on form you are opening]=" & Me!
[linking field on openform]

DoCmd.OpenForm stDocName, , , stLinkCriteria

Rick
 
Rick,

I copied what you posted, with my modifications;
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Magnify"

stLinkCriteria = "[Stock_Number]=" & Me![Stock_Number]

DoCmd.OpenForm stDocName, , , stLinkCriteria
Is this correct?

I received this;
run-time error '3075":
Syntax error (missing operator) in query expression
"[Stock_Number]=100500674'.

This is the correct Field I am wanting to "Magnify". Now can you help me the
rest of the way?


Thank you sooo much for your assistance!
Daren
 
Back
Top