On Double Click

  • Thread starter Thread starter Guest
  • Start date Start date
JohnLute said:
How can I format a subform combo box to open it's record with a
double-click?

Thanks!

It's not clear to me what you mean. Do you want to position the subform
to the record whose key is selected in the combo box? Open a separate
form showing that record? Something else entirely?
 
The double click needs to open the form that's associated with the chosen record

Thanks

----- Dirk Goldgar wrote: ----

JohnLute said:
How can I format a subform combo box to open it's record with
double-click

It's not clear to me what you mean. Do you want to position the subfor
to the record whose key is selected in the combo box? Open a separat
form showing that record? Something else entirely
 
Suppose that the combo box is named "MyCombo", the form to be opened is
named "MyForm", and the combo box's bound column is equivalent to the
field "ID" in the recordsource of the form. Then you could have a
DblClick event procedure for the combo box like this:

Private Sub MyCombo_DblClick(Cancel As Integer)

DoCmd.OpenForm "MyForm", _
WhereCondition:="ID=" & Me!MyCombo

End Sub

That assumes that ID is a numeric value. If it's a text value, this
variation will probably work:

DoCmd.OpenForm "MyForm", _
WhereCondition:="ID=""" & Me!MyCombo & """"
 
Thanks! I'm not sure I explained myself clearly. The combo box queries a table with that relates to multiple forms. In other words, the combo box needs to open any number of forms depending on the data that has been chosen

If I follow your suggestion then the combo box is limited to opening just the particular form. My combo box needs to open any number of forms

Can this be done?

----- Dirk Goldgar wrote: ----

Suppose that the combo box is named "MyCombo", the form to be opened i
named "MyForm", and the combo box's bound column is equivalent to th
field "ID" in the recordsource of the form. Then you could have
DblClick event procedure for the combo box like this

Private Sub MyCombo_DblClick(Cancel As Integer

DoCmd.OpenForm "MyForm",
WhereCondition:="ID=" & Me!MyComb

End Su

That assumes that ID is a numeric value. If it's a text value, thi
variation will probably work

DoCmd.OpenForm "MyForm",
WhereCondition:="ID=""" & Me!MyCombo & """
 
JohnLute said:
Thanks! I'm not sure I explained myself clearly. The combo box
queries a table with that relates to multiple forms. In other words,
the combo box needs to open any number of forms depending on the data
that has been chosen.

If I follow your suggestion then the combo box is limited to opening
just the particular form. My combo box needs to open any number of
forms.

Can this be done?

Probably, but you're going to have to explain a lot more. What is the
rowsource of the combo box? What do you want to have happen in various
specific circumstances? At the moment, I'm completely lost as to what
you're trying to do.
 
JohnLute said:
Sorry - thanks for sticking with me!

I have a table called tblProfiles. This stores info for multiple
TYPES of records. The primary key is txtProfileID. The different
TYPES of records are: CG, FG, BG, LA, PL, etc.

The combo box queries the txtProfileID, txtDescription and txtType
fields in the tblProfiles. I need to be able to make a selection in
the combo box and double click it to go to its form.

I'm guessing that this is too intricate for a combo box.

If the name of the form can be determined from the value of the txtType
column of the combo box, then it's not a problem. For example:

Select Case Me!cboProfile.Column(2) ' the third column
Case "CG"
DoCmd.OpenForm "Form1"
Case "FG"
DoCmd.OpenForm "Form2"
Case "BG"
DoCmd.OpenForm "Form3"
' ... and so on ...
End Select

Or, if the names of the forms are constructed from the types, you might
even do something like this:

DoCmd.OpenForm "Form" & Me!cboProfile.Column(2)

to open "FormCG", "FormFG", "FormBG", etc.
 
SUPER! Thanks a bunch, Dirk! I'll give it a shot first thing Monday

----- Dirk Goldgar wrote: ----

JohnLute said:
Sorry - thanks for sticking with me
TYPES of records. The primary key is txtProfileID. The differen
TYPES of records are: CG, FG, BG, LA, PL, etc
fields in the tblProfiles. I need to be able to make a selection i
the combo box and double click it to go to its form

If the name of the form can be determined from the value of the txtTyp
column of the combo box, then it's not a problem. For example

Select Case Me!cboProfile.Column(2) ' the third colum
Case "CG
DoCmd.OpenForm "Form1
Case "FG
DoCmd.OpenForm "Form2
Case "BG
DoCmd.OpenForm "Form3
' ... and so on ..
End Selec

Or, if the names of the forms are constructed from the types, you migh
even do something like this

DoCmd.OpenForm "Form" & Me!cboProfile.Column(2

to open "FormCG", "FormFG", "FormBG", etc
 
Back
Top