Using a Wild Card in a Combo Box (Form Control)

M

Mark909

I have a column Project_ID

This contains values such as:

1111AB
0000BA
1234CD
8910PU
etc

Ive set up the combo boxes to work with queries to create reports using:

[Forms]![FormName]![txtProject_ID]

This works fine. However due to work done on the database before i joined
the company some of the Project_IDs have been duplicated in the same column
where there has been overlap between 2 or more projects.

For example data in Project_ID might be stored as:

0000BA 1111AB
1234CD 8910PU

I was wondering if it would be possible to for example select all records
that contain 1111AB so every record with 1111AB would be displayed even
though the column row contains 0000BA 1111AB?
 
J

John Spencer

Set the criteria as

LIKE "*" & [Forms]![FormName]![txtProject_ID] & "*"

That will return records that contain the txtProject_ID.



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
D

Damon Heron

Consider using LIKE in your query, along with "*" wild cards.

WHERE somefield Like "*" & searchvalue & "*"

Damon
 
M

Mark909

Brilliant thanks guys!!


John Spencer said:
Set the criteria as

LIKE "*" & [Forms]![FormName]![txtProject_ID] & "*"

That will return records that contain the txtProject_ID.



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================

I have a column Project_ID

This contains values such as:

1111AB
0000BA
1234CD
8910PU
etc

Ive set up the combo boxes to work with queries to create reports using:

[Forms]![FormName]![txtProject_ID]

This works fine. However due to work done on the database before i joined
the company some of the Project_IDs have been duplicated in the same column
where there has been overlap between 2 or more projects.

For example data in Project_ID might be stored as:

0000BA 1111AB
1234CD 8910PU

I was wondering if it would be possible to for example select all records
that contain 1111AB so every record with 1111AB would be displayed even
though the column row contains 0000BA 1111AB?
 

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

Top