One form to another

P

Paul Dennis

I have a form which lists all the records in a table. What I would like to do
is to be able to select 1 record or double click it or something which would
then open up another form just with that one record for edit.

Is this possible? and how?
 
D

Duane Hookom

The easiest method I know of is to add a command button in the detail
section of the continuous form that opens your new form based on the value
in the continuous form. Then find the double-click event of a control on
your main form and view its Event Procedure. Copy the code from the command
button into the On Double-Click event.

Once this is successful, you can delete the command button and the code for
the command button.
 
P

Paul Dennis

What would the code be to open the form based on the value. Can you give me
an example?
 
D

Duane Hookom

Dim strWhere as String
Dim strFormName as String
strWhere = "[IdField]=" & Me.txtIdField
strFormName ="frmDetailRecord"
DoCmd.OpenForm strFormName, acNormal, , strWhere

If your IDField is text, you would need to use:
strWhere = "[IdField]=""" & Me.txtIdField & """"
 
Top