can I use wildcards in combination with a reference in a query?

  • Thread starter Joost Linthorst
  • Start date
J

Joost Linthorst

Refering to a form, goes like this:
SELECT *
FROM Track
Where Tracktitel = [forms]![Track_Delete]![text0]

When you use a wildcard it goes likte this
SELECT *
FROM Track
Where Tracktitel Like 'a*'

I would like a combination of those two, so you can type the 'a' (or another
character) in the form. And have a result of al tracktitels that start with
an 'a' (or the selected character)

I predicted that the query then would look like this:
SELECT *
FROM Track
Where Tracktitel = [forms]![Track_Delete]![text0] *

Unfortunnaly this doesn't work,
does anyone know if this is possible?, and how?

I would be very gratefull if you guys could help me out here

Joost
 
R

RoyVidar

Joost Linthorst wrote in message
Refering to a form, goes like this:
SELECT *
FROM Track
Where Tracktitel = [forms]![Track_Delete]![text0]

When you use a wildcard it goes likte this
SELECT *
FROM Track
Where Tracktitel Like 'a*'

I would like a combination of those two, so you can type the 'a' (or
another character) in the form. And have a result of al tracktitels
that start with an 'a' (or the selected character)

I predicted that the query then would look like this:
SELECT *
FROM Track
Where Tracktitel = [forms]![Track_Delete]![text0] *

Unfortunnaly this doesn't work,
does anyone know if this is possible?, and how?

I would be very gratefull if you guys could help me out here

Joost

If you're within the SQL view of the query tool, it might look like
this

Where Tracktitel Like [forms]![Track_Delete]![text0] & "*"
 
O

Ofer Cohen

Try this

SELECT *
FROM Track
Where Tracktitel Like [forms]![Track_Delete]![text0] & "*"
 
J

Joost Linthorst

I've tried this already

but the problem is that it keeps showing ALL results regardless of the
character i've written in the Form.
maybe someone knows an other mistake i could have made? or an other way to
do this?

Joost


Ofer Cohen said:
Try this

SELECT *
FROM Track
Where Tracktitel Like [forms]![Track_Delete]![text0] & "*"

--
Good Luck
BS"D


Joost Linthorst said:
Refering to a form, goes like this:
SELECT *
FROM Track
Where Tracktitel = [forms]![Track_Delete]![text0]

When you use a wildcard it goes likte this
SELECT *
FROM Track
Where Tracktitel Like 'a*'

I would like a combination of those two, so you can type the 'a' (or another
character) in the form. And have a result of al tracktitels that start with
an 'a' (or the selected character)

I predicted that the query then would look like this:
SELECT *
FROM Track
Where Tracktitel = [forms]![Track_Delete]![text0] *

Unfortunnaly this doesn't work,
does anyone know if this is possible?, and how?

I would be very gratefull if you guys could help me out here

Joost
 
O

Ofer Cohen

It will show all the records only if there is no data entered in the text box
text0, in that case it will like having this select SQL, so it will return
all the records

SELECT *
FROM Track
Where Tracktitel Like "*"

make sure that the text box name is right and there is data in it.

--
Good Luck
BS"D


Joost Linthorst said:
I've tried this already

but the problem is that it keeps showing ALL results regardless of the
character i've written in the Form.
maybe someone knows an other mistake i could have made? or an other way to
do this?

Joost


Ofer Cohen said:
Try this

SELECT *
FROM Track
Where Tracktitel Like [forms]![Track_Delete]![text0] & "*"

--
Good Luck
BS"D


Joost Linthorst said:
Refering to a form, goes like this:
SELECT *
FROM Track
Where Tracktitel = [forms]![Track_Delete]![text0]

When you use a wildcard it goes likte this
SELECT *
FROM Track
Where Tracktitel Like 'a*'

I would like a combination of those two, so you can type the 'a' (or another
character) in the form. And have a result of al tracktitels that start with
an 'a' (or the selected character)

I predicted that the query then would look like this:
SELECT *
FROM Track
Where Tracktitel = [forms]![Track_Delete]![text0] *

Unfortunnaly this doesn't work,
does anyone know if this is possible?, and how?

I would be very gratefull if you guys could help me out here

Joost
 
Top