Help with OpenArg

B

bunnyca

This has been driving me nuts for about a week now so I thought someone more
experienced might have the answer as although it's complex for me, the
newbie, it really is realtively simple.

Q: I am using Access 2000. I have a client database. I am making a search
form. The form is in dataview. It gets it's info. from a query that sorts the
info from the client table. The info consists of the contactfirstname,
contactlastname, ClientID, nextactiondate, and case status.

When the user double clicks on a particular client's info. I would like for
the "Clients" form to open up to that client's information by matching the
ClientID.

Note the ClientID is "Required" and is the primary key.

At this point, the "Clients" form opens but not to the client's specific
information.

I do not have coding regarding this in the "Clients" form coding.

Here is what I have so far for the "ClientSearch" Form coding:

Option Compare Database

Private Sub OpenClients()
DoCmd.OpenForm "Clients", acNormal, , , acReadOnly, , lClientID
End Sub
Sub Form_Open(Cancel As Integer)
Dim lClientID As Long
' If OpenArgs property contains employee name, find
' corresponding employee record and display it on form. For
' example,if the OpenArgs property contains "Callahan",
' move to first "Callahan" record.
lClientID = Forms!Clients.OpenArgs
If lClientID > 0 Then
DoCmd.GoToControl "ClientID"
DoCmd.FindRecord lClientID, , True, , True, , True
End If
End Sub

Private Sub ClientID_DblClick(Cancel As Integer)
OpenClients
End Sub

Private Sub ContactLastName_DblClick(Cancel As Integer)
OpenClients
End Sub
Private Sub ContactFirstName_DblClick(Cancel As Integer)
OpenClients
End Sub
Private Sub NextActionDate_DblClick(Cancel As Integer)
OpenClients
End Sub

Private Sub Case_Worker_DblClick(Cancel As Integer)
OpenClients
End Sub

-----------------------------------------------------------

As you can probably tell I am doing this in piecework! Any help is greatly
appreciated!!!!

Thanx so much.
 
S

Steve Schapel

Bunny,

Like this:

Private Sub OpenClients()
DoCmd.OpenForm "Clients", , , "ClientID = " & Me.ClientID, acReadOnly
End Sub

Just completely remove the Form_Open code, it's not doing anything
useful at all.
 
B

bunnyca

Thank you, thank you so very much for your assistance!!! It works wonderfully
and much more simple than everything I was trying!
 
B

bunnyca

Oh, now I am having another problem. How do I make it not "Read Only" So that
users can edit the forms?
 
B

bunnyca

Oh, nevermind... I simply deleted the ", acReadOnly" and now it is able to be
editied.
:0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top