Select records from table

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

Guest

I would like to select only certain records from a table, based on how a user answers a question.

Say I have a table with a music collection, and the first field in the form asks whether the user wants to update records, CDs, or tapes. The form should then only pull up that type to be updated.

Thanks!
 
In the field's AfterUpdate method, use DoCmd.ApplyFilter
to restrict the records that appear on the form e.g.

Private Sub TextType_AfterUpdate()
DoCmd.ApplyFilter , "[<column name>] = '" & TextType.value
End Sub

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I would like to select only certain records from a table,
based on how a user answers a question.
Say I have a table with a music collection, and the first
field in the form asks whether the user wants to update
records, CDs, or tapes. The form should then only pull up
that type to be updated.
 
Sorry, I don't understand where to put the names of my fields. Assuming the question asking for music form is "Question", the user response is "Answer", and the music medium (CD, tape) is "Type", where would I plug those in?

----- Gerald Stanley wrote: ----

In the field's AfterUpdate method, use DoCmd.ApplyFilte
to restrict the records that appear on the form e.g

Private Sub TextType_AfterUpdate(
DoCmd.ApplyFilter , "[<column name>] = '" & TextType.valu
End Su

Hope That Help
Gerald Stanley MCSD
-----Original Message----
I would like to select only certain records from a table
based on how a user answers a questionfield in the form asks whether the user wants to updat
records, CDs, or tapes. The form should then only pull u
that type to be updated.
 
I did try again, but got the following error when I clicked on the Option Button: 'Microsoft Access can't find the macro 'Private Sub TextType_AfterUpdate()'

I typed what had been suggested in the AfterUpdate section of the Option Button field, substituting <column name> with the name in my form.

Ideas?
 
If the text box where the user types in is called "Answer"
and the column name on the Table is called "Type", the code
should look something like

Private Sub Answer_AfterUpdate()
DoCmd.ApplyFilter , "[Type] = '" & Answer.value
End Sub

Hope That Helps

Gerald Stanley MCSD
-----Original Message-----

Sorry, I don't understand where to put the names of
my fields. Assuming the question asking for music form is
"Question", the user response is "Answer", and the music
medium (CD, tape) is "Type", where would I plug those in?
----- Gerald Stanley wrote: -----

In the field's AfterUpdate method, use DoCmd.ApplyFilter
to restrict the records that appear on the form e.g.

Private Sub TextType_AfterUpdate()
DoCmd.ApplyFilter , "[<column name>] = '" & TextType.value
End Sub

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I would like to select only certain records from a
table,
based on how a user answers a question. first
field in the form asks whether the user wants to update
records, CDs, or tapes. The form should then only pull up
that type to be updated.
.
 
Back
Top