• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 130
  • Last Modified:

move command

I am trying to make a program that uses an access database.

I need to ask after a string and then give the possible fields from the database.

Example:
In the database stands "Tom", "Anna", "Kim", "Bruno", ...
And you fill in as string "n".
Then it has to give the names "Anna", "Bruno"

Then i need to click on one of the names and then i need to go in the database to that field so i can alter it.

Can anybody help me with this

thx
0
Fireball1
Asked:
Fireball1
  • 2
1 Solution
 
TimCotteeHead of Software ServicesCommented:
What data access method are you going to use? ADO or DAO?
0
 
Ryan ChongCommented:
Hi Fireball1,

Use

"Select * from myTable Where myField = '%n%'"

or

"Select * from myTable Where myField = '*n*'"

regards.
0
 
Fireball1Author Commented:
I'm using a Data environment
0
 
TimCotteeHead of Software ServicesCommented:
Ok, so we are talking ADO. ryancys's first suggestion works here:

Dim strToMatch As String

sqlStatement = "Select * From MyTable Where MyField Like '%" & strToMatch & "%'"

Then use sqlStatement in your command object's recordsource property. Refresh the command and you have a narrowed down recordset, or alternatively use the recordset created by the command and filter it:

rsCommand1.Filter = "MyField = '%" & strToMatch & "%'"

You then have a filtered recordset with only the matching records.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now