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

How to open a new form from a datasheet row.

Status
Not open for further replies.

paulnnosh

MIS
Mar 25, 2004
32
I have a form with a subform showing a datasheet of overview information. I would like to be able to click on a line of the datasheet and open a new form with all the information from the clicked record that the user can edit.

How do I do this?

Thanks
 
See the docmd.openform method. You can pass criteria that limits the forms records to the record you want.

DoCmd.OpenForm "Employees", , ,"Recordid = " & me.recordid



 
Hiya,

The syntax above will not be accepted by the VB editor. I have tried:

DoCmd.OpenForm "frmProspect", , , "[ID] = '" & Me.ID & "'"

when this runs I get the error:

The OpenForm Action was cancelled.

If I take out the quotes around the form name

DoCmd.OpenForm frmProspect, , , "[ID] = '" & Me.ID & "'"

I get:

The action or method requires a form name argument.

Does anybody know the correct syntax?


 
Just guessing, but is you ID numeric? If so, drop the single guotes (text delimiters):

[tt]DoCmd.OpenForm "frmProspect", , , "[ID] = " & Me!ID[/tt]

Roy-Vidar
 
Fantastic - What an idiot. I can't belive I didn't work that one out for myself.

Thank you all for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top