Open Form by highlighting a record in the Subform

ramez75

Registered User.
Local time
Today, 05:18
Joined
Dec 23, 2008
Messages
181
I dont know how to tackle this. I dont know if is is possible even.

I have a Form and in the form I have a Subform (View=Datasheet). On the form I also have a button. What I m trying to do is if someone highlights a record on the Subform and click the button on the form. This will open another form with all the data related to the record chosen in the subform.

Or maybe select the first field of the record in the subform and click the button on the form and this will result in opening the other form with the data

I hope that make sense......LEt me know if i need to be more descriptive

Any ideas/help is greatly appreciated
 
pbaldy, I looked at the below

Code:
[FONT=Courier New]DoCmd.OpenForm "SecondFormName", , , "FieldName = [COLOR=#ff0000]'[/COLOR]" & Me.ControlName[COLOR=#ff0000] & "'"[/COLOR][/FONT]

My question is about the Me.ControlName, the control is not on the form but is on the Subform. Hence will mine look something like that

Code:
[FONT=Courier New]DoCmd.OpenForm "SecondFormName", , , "FieldName = [COLOR=#ff0000]'[/COLOR]" & Form!SubformName!ControlName[COLOR=#ff0000] & "'"[/COLOR][/FONT]

I tried the above and I get an error. So I was wondering what did I do wrong
 
Last edited:
Right now the way i got it to work is I went to the control in the Subform and under the DblClick Event I added this

Code:
DoCmd.OpenForm "SecondForm", , , "ID = '" & Me.ID & "'"

The problem with the above if the User those not choose the ID control and choose another field in the subform and double click nothing is going to happen
 
You can put the same code behind other controls.
 
What I did to make it work like i want is I put it behind the DblClick event of the subform. Hence I click on the record of the subform and the second form opens up

thank you for guiding me in the right direction
 

Users who are viewing this thread

Back
Top Bottom