By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,650 Members | 1,976 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,650 IT Pros & Developers. It's quick & easy.

Combo dropdown list box (on Switchboard)-How to open a specific row?

P: n/a
What I'm trying for: If this selection or if click on selection
(highlighted line choice/
which ever selection change) w/in query's combo dropdown list box (on
Switchboard),
then Open in Datasheet View, the specific underlying record's Row...
showing all columns Or selected columns.

For a specific row's record ONLY, Or for all Xs (same type), or for the
whole data sheet
(all records... includes all types then), but focus still opens on the
specific selection.

Is there anyone that knows how to do this & explain using correct
syntax, in simplest clear terms? Here's what I have (record source
is query):
Private Sub QueryQ_Click()
If Me.[TableNameABC]![FieldX] Then
Me.[FieldX:Yes] = "x"
End If
If Me.[TableNameABC]![FieldY] Then
Me.[FieldY:Yes] = "y"
End If
If Me.[TableNameABC]![FieldZ] Then
Me.[FieldZ:Yes] = "z"
End If
Hope this is clear. THANKS in advance!!

Aug 1 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

Cagey wrote:
What I'm trying for: If this selection or if click on selection
(highlighted line choice/
which ever selection change) w/in query's combo dropdown list box (on
Switchboard),
then Open in Datasheet View, the specific underlying record's Row...
showing all columns Or selected columns.

For a specific row's record ONLY, Or for all Xs (same type), or for the
whole data sheet
(all records... includes all types then), but focus still opens on the
specific selection.

Is there anyone that knows how to do this & explain using correct
syntax, in simplest clear terms? Here's what I have (record source
is query):
Private Sub QueryQ_Click()
If Me.[TableNameABC]![FieldX] Then
Me.[FieldX:Yes] = "x"
End If
If Me.[TableNameABC]![FieldY] Then
Me.[FieldY:Yes] = "y"
End If
If Me.[TableNameABC]![FieldZ] Then
Me.[FieldZ:Yes] = "z"
End If
Hope this is clear. THANKS in advance!!
I *think* I understand. You want to choose which field to filter by.
If you're filtering a report or form's records, then it's easy.

I think your problem is that you're not filtering by a single field.
IOW, [Field1]={some value], but a group of possible fields. The only
way to do that is to build the Where clause on the fly and then pass
the where clause in the open event of the form/report.

Private Sub cmdOpenEmployeeForm_Click()
DoCmd.OpenForm "frmEmployee", acNormal, , "EmployeeID=" &
Me.Combo2, acFormEdit, acDialog
End Sub

otherwise, you need to build the where clause on the fly.

say you have
an unbound combobox of field names: cboFieldName
an unbound textbox where you can type in a text value: txtValue

Private Sub cmdOpenEmployeeForm_Click()
dim strFilter as string
const cQUOTE as string ="'"
strFilter = "[" & Me.cboFieldName & "] = " & cQUOTE & Me.txtValue &
cQUOTE

DoCmd.OpenForm "frmEmployee", acNormal, , strFilter, acFormEdit,
acDialog
End Sub

or did you mean something else?

Aug 1 '06 #2

P: n/a

pi********@hotmail.com wrote:
Cagey wrote:
What I'm trying for: If this selection or if click on selection
(highlighted line choice/
which ever selection change) w/in query's combo dropdown list box (on
Switchboard),
then Open in Datasheet View, the specific underlying record's Row...
showing all columns Or selected columns.

For a specific row's record ONLY, Or for all Xs (same type), or for the
whole data sheet
(all records... includes all types then), but focus still opens on the
specific selection.

Is there anyone that knows how to do this & explain using correct
syntax, in simplest clear terms? Here's what I have (record source
is query):
Private Sub QueryQ_Click()
If Me.[TableNameABC]![FieldX] Then
Me.[FieldX:Yes] = "x"
End If
If Me.[TableNameABC]![FieldY] Then
Me.[FieldY:Yes] = "y"
End If
If Me.[TableNameABC]![FieldZ] Then
Me.[FieldZ:Yes] = "z"
End If
Hope this is clear. THANKS in advance!!

I *think* I understand. You want to choose which field to filter by.
If you're filtering a report or form's records, then it's easy.

I think your problem is that you're not filtering by a single field.
IOW, [Field1]={some value], but a group of possible fields. The only
way to do that is to build the Where clause on the fly and then pass
the where clause in the open event of the form/report.

Private Sub cmdOpenEmployeeForm_Click()
DoCmd.OpenForm "frmEmployee", acNormal, , "EmployeeID=" &
Me.Combo2, acFormEdit, acDialog
End Sub

otherwise, you need to build the where clause on the fly.

say you have
an unbound combobox of field names: cboFieldName
an unbound textbox where you can type in a text value: txtValue

Private Sub cmdOpenEmployeeForm_Click()
dim strFilter as string
const cQUOTE as string ="'"
strFilter = "[" & Me.cboFieldName & "] = " & cQUOTE & Me.txtValue &
cQUOTE

DoCmd.OpenForm "frmEmployee", acNormal, , strFilter, acFormEdit,
acDialog
End Sub

or did you mean something else?
Just making sure we're on the same pg... I'd like to be able to enter
directly into a row on a dropdown which pulls from either a query or
directly from a table. This query's dropdown is on the Switchboard (if
that matters). Phoney Ex. -
Row 1 || Name1 || Name2 || Name3
Row 2 || Descrips
Row 3 || Labels today || Labels yesterday 45 || More
Row 4 || Labels today || Labels yesterday 410
Query may narrow database records' view to 3 or 4 columns w/in the
dropdown list like above ex. (|| represents column end here), but maybe
the user wants to click into Row 3, so they can pick/go directly to
line of info. selected, either showing only that line, plus all it's
other columns (additional columns - same line in the database, but not
part of query), or go directly to that line, while allowing user to see
all database columns/rows (records), rather than having to scroll or
search for the line they wanted. It sounds like I may be asking
something diff. than what you answered?? Not sure. Please let me know.
THANKS!!!

Aug 2 '06 #3

P: n/a
Just making sure we're on the same pg... I'd like to be able to enter
directly into a row on a dropdown which pulls from either a query or
directly from a table. This query's dropdown is on the Switchboard (if
that matters). Phoney Ex. -
Row 1 || Name1 || Name2 || Name3
Row 2 || Descrips
Row 3 || Labels today || Labels yesterday 45 || More
Row 4 || Labels today || Labels yesterday 410
Query may narrow database records' view to 3 or 4 columns w/in the
dropdown list like above ex. (|| represents column end here), but maybe
the user wants to click into Row 3, so they can pick/go directly to
line of info. selected, either showing only that line, plus all it's
other columns (additional columns - same line in the database, but not
part of query), or go directly to that line, while allowing user to see
all database columns/rows (records), rather than having to scroll or
search for the line they wanted. It sounds like I may be asking
something diff. than what you answered?? Not sure. Please let me know.
THANKS!!!
Ify ou want to change the controlsource of your combobox on the fly,
you'd have to do it with code. I think that's what you mean, because
there's no other way to change the number of columns returned by a
query. (Well, unless you change the controlsource of the combobox to
some other query object or SQL statement. And then you'd have to
change the number of columns shown in the combobox control. but I'm
completely guessing what you're talking about. how about a REAL
example, because most of what you've said so far, at least from a pure
database standpoint, doesn't make much sense to me. Again, maybe I'm
missing the point, but so far nobody else has answered...

If all you _really_ want is to filter a form in the open event of the
form (as the subject says), so you see only all the records with a
field value in common, then that's a walk. All you have to do is
specify a filter (valid WHERE clause without the "WHERE") in the Open
event of the form.

But the way you are talking about varying numbers of columns in your
combobox, I'm not sure what you're really after. So how about giving a
real example?

Thanks,
Pieter

Aug 3 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.