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?