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

Double click in sub form

Status
Not open for further replies.

awesomet

Technical User
Jan 2, 2005
13
ZA
Hiya need some help with some code please...need to double click in a sub form that will open in a form and display the double clicked record...I have the following but it is not working:

Private Sub Form_DblClick()
DoCmd.OpenForm "awesome1", , , [paxID] = Me![paxID]
End Sub


Thank you
 
I would guess that you need to use the DblClick event for a control(or several controls, if the user has a choice), rather than the form.
 
Hi

Thank you for the reply...

OK trying a diffrent way and moved it to the control, in this case [paxid]

Private Sub paxID_DblClick(Cancel As Integer)

DoCmd.OpenForm "awesome1", , , "[paxID] = " & Me!paxID

End Sub

However it is coming up with an error:Run tim error '3709'
The search key was not found in any record ?

How do I set the search key ?

Thank you
 
Try creating a commandbutton through wizard to open the second form linking the criteria. Then you can copy & Paste the code (with necessary changes) to the DoubleClick event of the first form.
regards


Zameer Abdulla
Visit Me
 
The reply from Zameer should fix things.

Alternatively, put a messagebox in to show what is happening:

Private Sub paxID_DblClick(Cancel As Integer)
msgbox me!paxid
DoCmd.OpenForm "awesome1", , , "[paxID] = " & Me!paxID

End Sub
 
Hi

Wow that is a cool trick and got code now however the error is still coming up:

However it is coming up with an error:Run time error '3709'
The search key was not found in any record ?

My code now looks like:

Private Sub paxID_DblClick(Cancel As Integer)

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "awesome1"

stLinkCriteria = "[paxID]=" & Me![paxID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub

any ideas?

Thank you
 
Did you try MsgBox as Lupins46 written?
also, did you try opening the form by the command button?
Code:
Private Sub paxID_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "awesome1"
stLinkCriteria = "[paxID]=" & Me![paxID]
[b]Msgbox Me!paxid[/b]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub


Zameer Abdulla
Visit Me
 
Hi

Did try both the command button and the message box however I still have the same error....the sub form is in dataview displaying the records...

The [paxID] is displayed in the message box so it is taking the linking code correct ? I am stumped ?

Thanx
 
Hi

There was a problem with the awesome1 form all sorted and working now...

Thank you all...
 
How are ya awesomet . . . . .

What is the [blue]RecordSource[/blue] of [purple]awesome1[/purple]?

Calvin.gif
See Ya! . . . . . .
 
Hi

Recordsource is "awesome" same the thesubform...

all sorted...; )

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top