Double-Click A Record To Open A Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello Again,

I would like to be able to double-click a record called "LastName" in a form
"Client Select" that's for viewing and have another form "Client Form" open
and display the record that was clicked.

The primary key is an autonumber field named "ContactID". I have tried using
the following code, but it prompts for a parameter value instead of opening
Client Form with the appropriate record:

Private Sub LastName_DblClick(Cancel As Integer)
DoCmd.OpenForm "Client Form", , , "Me.ContactID", , acDialog
End Sub

Is it possible to achieve this using an autonumber field?

-Sky
 
Try this instead. I'm assuming there is a table named [Clients Info] that is
the recordsource of your subform.

DoCmd.OpenForm "Client Form", , , "[Clients Info]![MemberID] = Forms![Client
Select]![MemberID]", , acDialog
 
Hi Lynn,

YOU ARE THE BOMB! With a little tweaking to your code it works flawlessly. I
am so happy it's working and I could just kiss you. Lynn, you are certainly
worthy of your MVP branding :-)

Thank you very, very much!!!

Lynn Trapp said:
Try this instead. I'm assuming there is a table named [Clients Info] that is
the recordsource of your subform.

DoCmd.OpenForm "Client Form", , , "[Clients Info]![MemberID] = Forms![Client
Select]![MemberID]", , acDialog


--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Sky Warren said:
Hello Again,

I would like to be able to double-click a record called "LastName" in a
form
"Client Select" that's for viewing and have another form "Client Form"
open
and display the record that was clicked.

The primary key is an autonumber field named "ContactID". I have tried
using
the following code, but it prompts for a parameter value instead of
opening
Client Form with the appropriate record:

Private Sub LastName_DblClick(Cancel As Integer)
DoCmd.OpenForm "Client Form", , , "Me.ContactID", , acDialog
End Sub

Is it possible to achieve this using an autonumber field?

-Sky
 
I'm glad it helped. :-)

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Sky Warren said:
Hi Lynn,

YOU ARE THE BOMB! With a little tweaking to your code it works flawlessly.
I
am so happy it's working and I could just kiss you. Lynn, you are
certainly
worthy of your MVP branding :-)

Thank you very, very much!!!

Lynn Trapp said:
Try this instead. I'm assuming there is a table named [Clients Info] that
is
the recordsource of your subform.

DoCmd.OpenForm "Client Form", , , "[Clients Info]![MemberID] =
Forms![Client
Select]![MemberID]", , acDialog


--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Sky Warren said:
Hello Again,

I would like to be able to double-click a record called "LastName" in a
form
"Client Select" that's for viewing and have another form "Client Form"
open
and display the record that was clicked.

The primary key is an autonumber field named "ContactID". I have tried
using
the following code, but it prompts for a parameter value instead of
opening
Client Form with the appropriate record:

Private Sub LastName_DblClick(Cancel As Integer)
DoCmd.OpenForm "Client Form", , , "Me.ContactID", , acDialog
End Sub

Is it possible to achieve this using an autonumber field?

-Sky
 
Lynn-

For some reason, this code does not behave for me. It 'appears' to run
smoothy, but when it comes to opening the "Client Form", i get a blank form.

any ideas what i'm doing wrong?

/amelia

Lynn Trapp said:
Try this instead. I'm assuming there is a table named [Clients Info] that is
the recordsource of your subform.

DoCmd.OpenForm "Client Form", , , "[Clients Info]![MemberID] = Forms![Client
Select]![MemberID]", , acDialog


--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Sky Warren said:
Hello Again,

I would like to be able to double-click a record called "LastName" in a
form
"Client Select" that's for viewing and have another form "Client Form"
open
and display the record that was clicked.

The primary key is an autonumber field named "ContactID". I have tried
using
the following code, but it prompts for a parameter value instead of
opening
Client Form with the appropriate record:

Private Sub LastName_DblClick(Cancel As Integer)
DoCmd.OpenForm "Client Form", , , "Me.ContactID", , acDialog
End Sub

Is it possible to achieve this using an autonumber field?

-Sky
 
Try this:

In the wherecondition, you need change "[controlname on other form]" to the
name of the field on "Client Select" that you use to select the member Id.

This is what the code should look like:


'**
Dim stDocName As String
Dim stLinkCriteria As String
Dim strWindowMode as integer

stDocName = "Client Select"

stLinkCriteria = _
"[ContactID] = " & Forms![Client Select]![controlname on other form]

strWindowMode = acDialog 'acDialog = 3

DoCmd.OpenForm stDocName, , , stLinkCriteria,, windowmode

'**



HTH
--
Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
Lynn-

For some reason, this code does not behave for me. It 'appears' to run
smoothy, but when it comes to opening the "Client Form", i get a blank form.

any ideas what i'm doing wrong?

/amelia

:

Try this instead. I'm assuming there is a table named [Clients Info] that is
the recordsource of your subform.

DoCmd.OpenForm "Client Form", , , "[Clients Info]![MemberID] = Forms![Client
Select]![MemberID]", , acDialog


--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Hello Again,

I would like to be able to double-click a record called "LastName" in a
form
"Client Select" that's for viewing and have another form "Client Form"
open
and display the record that was clicked.

The primary key is an autonumber field named "ContactID". I have tried
using
the following code, but it prompts for a parameter value instead of
opening
Client Form with the appropriate record:

Private Sub LastName_DblClick(Cancel As Integer)
DoCmd.OpenForm "Client Form", , , "Me.ContactID", , acDialog
End Sub

Is it possible to achieve this using an autonumber field?

-Sky
 
Steve-

Thanks loads, this really helped.

I'm actually opening a Report here and this is what I've got:

Private Sub Command36_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim strWindowMode As Integer

stDocName = "R-Trips"

stLinkCriteria = _
"[TripID] = " & Forms![F-Trips]![TripID]

strWindowMode = acDialog 'acDialog = 3
DoCmd.OpenReport stDocName, , , stLinkCriteria, , windowmode
DoCmd.OpenReport
End Sub

....two things are happening here that make me scowl.
1. The report automatically prints - does not go to print preview mode

2. The Traveler's name isn't being carried over to the report. When i click
my button to switch to the report, i am asked the Traveler's Name. The data
is [T-Trips].[Traveler] which is that same as [T-Contacts].[ContactID] - an
autonumber.

any ideas why that parameter isn't passing over?

/amelia
 
FYI - I solve problem two on my own. SEU error.

If only i could just bring the report to print preview mode...


/aae
 
Okay - I solved it all

1. i was mapping the traveler field incorrectly
2. acViewPreview


thanks a million!
/aae
 
Back
Top