Searching in forms

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

Guest

Hi there

Im a novice Access user, so apologies if this question is a little basic.

My database is relatively simple, one table and one form. Many users will
access the forms and I would like them to be able to search for address
(address is one of the fields of which there are 10 in total).

I would like this search to allow non-exact matches and ideally be as simple
as possible for the user to action. Ideally, click on a button, type in
address and click to search.

Any advice?

Thanks
 
Use an unbound combo box for your search. The Combo wizard should guide you
through the process.
 
You should give it a try with the combo box wizard. Open the toolbox and be
sure the magic wand icon is highlighted. Fine the combo box icon in the
toolbox, and drag it to the form. The wizard will start. Follow the
prompts, choosing the option to "Find a record based on the combo box
selection" (or something to that effect). If it does not behave as
expected, post the specific difficulties.
 
Hi

Thanks for that, this is working...sort of.

It was working initially anyway, however, now when I click on the drop down
menu the debugger message comes up and highlilghts the following code -

Private Sub Combo48_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Reference Number] = '" & Me![Combo48] & "'"
Me.Bookmark = rs.Bookmark
End Sub

Specifically the 'Me.Bookmarl = rs.Bookmark' line. Any ideas?

Thanks
 
Is Combo48 an unbound control? If not, it needs to be.
Is the bound field in Combo48 a text field? If it is a number field, try:
rs.FindFirst "[Reference Number] = " & Me![Combo48]
If still no luck, try retyping the line of code. If it still fails, try
making a new combo box. I have known code to get "stuck" for no apparent
(to me) reason.

JaB said:
Hi

Thanks for that, this is working...sort of.

It was working initially anyway, however, now when I click on the drop
down
menu the debugger message comes up and highlilghts the following code -

Private Sub Combo48_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Reference Number] = '" & Me![Combo48] & "'"
Me.Bookmark = rs.Bookmark
End Sub

Specifically the 'Me.Bookmarl = rs.Bookmark' line. Any ideas?

Thanks

BruceM said:
You should give it a try with the combo box wizard. Open the toolbox and
be
sure the magic wand icon is highlighted. Fine the combo box icon in the
toolbox, and drag it to the form. The wizard will start. Follow the
prompts, choosing the option to "Find a record based on the combo box
selection" (or something to that effect). If it does not behave as
expected, post the specific difficulties.
 
Thanks for that, unfortunately is still not working.

The combo box is unbound and the bound field is a text box. Deleted and
added a new box and also tried retyping the code but it imediately higlighted
the 'Me.Bookmark = rs.Bookmark' line as if that was not recognised...im
scratching my head, especially as this was working initially.

The field is looking at the first line of an address - not sure if that
should make any difference.

Any further suggestions?

Thanks

BruceM said:
Is Combo48 an unbound control? If not, it needs to be.
Is the bound field in Combo48 a text field? If it is a number field, try:
rs.FindFirst "[Reference Number] = " & Me![Combo48]
If still no luck, try retyping the line of code. If it still fails, try
making a new combo box. I have known code to get "stuck" for no apparent
(to me) reason.

JaB said:
Hi

Thanks for that, this is working...sort of.

It was working initially anyway, however, now when I click on the drop
down
menu the debugger message comes up and highlilghts the following code -

Private Sub Combo48_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Reference Number] = '" & Me![Combo48] & "'"
Me.Bookmark = rs.Bookmark
End Sub

Specifically the 'Me.Bookmarl = rs.Bookmark' line. Any ideas?

Thanks

BruceM said:
You should give it a try with the combo box wizard. Open the toolbox and
be
sure the magic wand icon is highlighted. Fine the combo box icon in the
toolbox, and drag it to the form. The wizard will start. Follow the
prompts, choosing the option to "Find a record based on the combo box
selection" (or something to that effect). If it does not behave as
expected, post the specific difficulties.

Thanks. How would I set that up to search and when found, populate the
fields?

:

Use an unbound combo box for your search. The Combo wizard should
guide
you
through the process.
--
Dave Hargis, Microsoft Access MVP


:

Hi there

Im a novice Access user, so apologies if this question is a little
basic.

My database is relatively simple, one table and one form. Many
users
will
access the forms and I would like them to be able to search for
address
(address is one of the fields of which there are 10 in total).

I would like this search to allow non-exact matches and ideally be
as
simple
as possible for the user to action. Ideally, click on a button,
type
in
address and click to search.

Any advice?

Thanks
 
The bound field is in a table. If you open the table in design view, what
is the field's data type (Text, Number, etc.)? A text box is a control
(along with combo boxes, check boxes, labels, lines, and just about anything
else on a form or report). A control may be bound to a field (have a field
in the form's Record Source table or query as its Control Source), and can
be formatted for a variety of data types.

JaB said:
Thanks for that, unfortunately is still not working.

The combo box is unbound and the bound field is a text box. Deleted and
added a new box and also tried retyping the code but it imediately
higlighted
the 'Me.Bookmark = rs.Bookmark' line as if that was not recognised...im
scratching my head, especially as this was working initially.

The field is looking at the first line of an address - not sure if that
should make any difference.

Any further suggestions?

Thanks

BruceM said:
Is Combo48 an unbound control? If not, it needs to be.
Is the bound field in Combo48 a text field? If it is a number field,
try:
rs.FindFirst "[Reference Number] = " & Me![Combo48]
If still no luck, try retyping the line of code. If it still fails, try
making a new combo box. I have known code to get "stuck" for no apparent
(to me) reason.

JaB said:
Hi

Thanks for that, this is working...sort of.

It was working initially anyway, however, now when I click on the drop
down
menu the debugger message comes up and highlilghts the following code -

Private Sub Combo48_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Reference Number] = '" & Me![Combo48] & "'"
Me.Bookmark = rs.Bookmark
End Sub

Specifically the 'Me.Bookmarl = rs.Bookmark' line. Any ideas?

Thanks

:

You should give it a try with the combo box wizard. Open the toolbox
and
be
sure the magic wand icon is highlighted. Fine the combo box icon in
the
toolbox, and drag it to the form. The wizard will start. Follow the
prompts, choosing the option to "Find a record based on the combo box
selection" (or something to that effect). If it does not behave as
expected, post the specific difficulties.

Thanks. How would I set that up to search and when found, populate
the
fields?

:

Use an unbound combo box for your search. The Combo wizard should
guide
you
through the process.
--
Dave Hargis, Microsoft Access MVP


:

Hi there

Im a novice Access user, so apologies if this question is a
little
basic.

My database is relatively simple, one table and one form. Many
users
will
access the forms and I would like them to be able to search for
address
(address is one of the fields of which there are 10 in total).

I would like this search to allow non-exact matches and ideally
be
as
simple
as possible for the user to action. Ideally, click on a button,
type
in
address and click to search.

Any advice?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top