How to put a search bar in an access form

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

Guest

Hi I have a bar in my form, but I like to put partial data of my Database in
this box and with this can search some possible records, can I do this, and
how??
 
It is possible to set the "Find" command with VBA code, but I would do it a
different way. Here is an example:


Dim rst As DAO.Recordset
Dim strRecord As String

Set rst = Me.RecordsetClone

'The following code allows you to look for someone in your database by
typing in part of the last name:
strRecord = "[LastName] Like *'" & Replace(Me!Text124, "'", "''") & "*'"

rst.FindFirst strRecord
Me.Bookmark = rst.Bookmark


Linda
 
Thank you Linda, but th problm is that I'm a 1st user, so I don't know how to
do this in VBA, is there's a better or easiest way???, or how can I do this
in VBA??

Thanks

Jorg

Linda Burnside said:
It is possible to set the "Find" command with VBA code, but I would do it a
different way. Here is an example:


Dim rst As DAO.Recordset
Dim strRecord As String

Set rst = Me.RecordsetClone

'The following code allows you to look for someone in your database by
typing in part of the last name:
strRecord = "[LastName] Like *'" & Replace(Me!Text124, "'", "''") & "*'"

rst.FindFirst strRecord
Me.Bookmark = rst.Bookmark


Linda




Jorge said:
Hi I have a bar in my form, but I like to put partial data of my Database
in
this box and with this can search some possible records, can I do this,
and
how??
 
Put the code I gave you in the On Update event.


Jorge said:
Thank you Linda, but th problm is that I'm a 1st user, so I don't know how
to
do this in VBA, is there's a better or easiest way???, or how can I do
this
in VBA??

Thanks

Jorg

Linda Burnside said:
It is possible to set the "Find" command with VBA code, but I would do it
a
different way. Here is an example:


Dim rst As DAO.Recordset
Dim strRecord As String

Set rst = Me.RecordsetClone

'The following code allows you to look for someone in your database by
typing in part of the last name:
strRecord = "[LastName] Like *'" & Replace(Me!Text124, "'", "''") & "*'"

rst.FindFirst strRecord
Me.Bookmark = rst.Bookmark


Linda




Jorge said:
Hi I have a bar in my form, but I like to put partial data of my
Database
in
this box and with this can search some possible records, can I do this,
and
how??
 
I don't have the On Update Event, and send me an error that doesn't find the
Text124

Linda Burnside said:
Put the code I gave you in the On Update event.


Jorge said:
Thank you Linda, but th problm is that I'm a 1st user, so I don't know how
to
do this in VBA, is there's a better or easiest way???, or how can I do
this
in VBA??

Thanks

Jorg

Linda Burnside said:
It is possible to set the "Find" command with VBA code, but I would do it
a
different way. Here is an example:


Dim rst As DAO.Recordset
Dim strRecord As String

Set rst = Me.RecordsetClone

'The following code allows you to look for someone in your database by
typing in part of the last name:
strRecord = "[LastName] Like *'" & Replace(Me!Text124, "'", "''") & "*'"

rst.FindFirst strRecord
Me.Bookmark = rst.Bookmark


Linda




Hi I have a bar in my form, but I like to put partial data of my
Database
in
this box and with this can search some possible records, can I do this,
and
how??
 
Okay. Create one. You need a text box at the top of your form (or
wherever) into which you will type part of the Name (or whatever field
you're searching on). Right click on the text box (in design mode). Select
Properties. Go to the Events tab. Look for the line that says "After
Update" (sorry, I called it by the wrong name earlier). Click on the
elipsis (the dots "..."). Select "Code Builder". Put the code I gave you
earlier in there.

Good luck,

Linda

Jorge said:
I don't have the On Update Event, and send me an error that doesn't find
the
Text124

Linda Burnside said:
Put the code I gave you in the On Update event.


Jorge said:
Thank you Linda, but th problm is that I'm a 1st user, so I don't know
how
to
do this in VBA, is there's a better or easiest way???, or how can I do
this
in VBA??

Thanks

Jorg

:

It is possible to set the "Find" command with VBA code, but I would do
it
a
different way. Here is an example:


Dim rst As DAO.Recordset
Dim strRecord As String

Set rst = Me.RecordsetClone

'The following code allows you to look for someone in your database by
typing in part of the last name:
strRecord = "[LastName] Like *'" & Replace(Me!Text124, "'", "''") &
"*'"

rst.FindFirst strRecord
Me.Bookmark = rst.Bookmark


Linda




Hi I have a bar in my form, but I like to put partial data of my
Database
in
this box and with this can search some possible records, can I do
this,
and
how??
 
Here is a good demo using Flash Player that demonstates how to navigate in
Access to use VBA Code.

http://www.datapigtechnologies.com/AccessMain.htm



Jorge said:
Thank you Linda, but th problm is that I'm a 1st user, so I don't know how
to
do this in VBA, is there's a better or easiest way???, or how can I do
this
in VBA??

Thanks

Jorg

Linda Burnside said:
It is possible to set the "Find" command with VBA code, but I would do it
a
different way. Here is an example:


Dim rst As DAO.Recordset
Dim strRecord As String

Set rst = Me.RecordsetClone

'The following code allows you to look for someone in your database by
typing in part of the last name:
strRecord = "[LastName] Like *'" & Replace(Me!Text124, "'", "''") & "*'"

rst.FindFirst strRecord
Me.Bookmark = rst.Bookmark


Linda




Jorge said:
Hi I have a bar in my form, but I like to put partial data of my
Database
in
this box and with this can search some possible records, can I do this,
and
how??
 
Back
Top