Full Version: Double Click Open Form
UtterAccess Forums > Microsoft® Access > Access Forms
paspencer
I have a form that has a sub form on it. I need to do a double click on one of the records and have it open another form.
I have it working on another form where it just looks at an id and opens the form with that id, however the new form has an id and also a clientid and planid.
How can I change this code:
CODE
If Not IsNull(Me.txtPID) Then
DoCmd.OpenForm "frmPlanProcessEdit", , , , , acWindowNormal, Me.txtPID
End If

To open the form with the correct id, clientid and planid. As if stands now it opens the form with all of the clients and plans that have that ID.
Thanks in advance.
Trice
Alan_G
Hi
ou're using the OpenArgs argument in the code you posted, so I'm guessing that a filter or similar is being applied in the Open or Load event of frmPlanProcessEdit.
If you use the WHERE argument, you can use it like WHERE in a query (except without the word WHERE) and have multiple criteria. So, for example, if all 3 of your ID's are numeric you could do this
CODE
DoCmd.OpenForm "frmPlanProcessEdit", , , "PID = " & Me.txtPID & " AND ClientID = " _
& Me.txtClientID & " AND PlanID = " & Me.txtPlanID , , acWindowNormal
paspencer
Alan,
Thanks so much for answering. It put me on the right track except that the form opens but not records are displayed.
The PID is numeric but the ClientID and PlanID are text. That makes a difference with my "'s in the code, correct?
Trice
Alan_G
Hi
ep, text makes a difference - it would be
CODE
DoCmd.OpenForm "frmPlanProcessEdit", , , "PID = " & Me.txtPID & " AND ClientID = '" _
& Me.txtClientID & "' AND PlanID = '" & Me.txtPlanID & "'", , acWindowNormal
paspencer
Alan - Thanks so much. You rock! It works like a charm. Now if I can get the rest of the group together and stop changing requirements as soon as I have programmed a section I would be doing something.
think I would like developing databases if it weren't for the users.
Thanks again.
Trice
Alan_G
users, you just gotta love &#
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.