parameter query works with combo box, but not text box

G

gisj

Hello. I have been working with a test database to see how parameter queries
work, specifically having users use a form to provide the parameters before
implementing them in the main database. I am able to get this to work by
using a combo box in the form and then setting the query criteria to
[Forms]![FormName]![ComboBoxName]. However, if I do the same actions in
another query, but use a text box instead of a combo box with
[Forms]![FormName]![TextBoxName], no records are returned. I have ensured
that there is a record for the text I am entering. I am using Access 2007.

Thoughts?
 
M

Maurice

Check the following:

- What's the datatype of the field which you've place the parameter on (is
it a text)
- Did you type the actual value in the textbox, when evaluating the data
entered has to be the exact same as the value in your recordset
- is the field an unbound field (no source control)

just a few thoughts
 
G

gisj

Thank you for your response.

The data type is text as set in the design view of the table (though it is
numbers that are actually entered into the field, this is merely an ID field
- no calculations are being performed). Is there somewhere else, like in the
form, the data type needs to be set?

Yes, I directly typed the value into the text box on the form. Since this
is a test database, I have made the values really simple such as 1, 2, 3...

Yes, the textbox is unbound.

Also, if I just use the simple approach of [enter message here] in the query
criteria, the query returns the correct records.

Maurice said:
Check the following:

- What's the datatype of the field which you've place the parameter on (is
it a text)
- Did you type the actual value in the textbox, when evaluating the data
entered has to be the exact same as the value in your recordset
- is the field an unbound field (no source control)

just a few thoughts

--
Maurice Ausum


gisj said:
Hello. I have been working with a test database to see how parameter queries
work, specifically having users use a form to provide the parameters before
implementing them in the main database. I am able to get this to work by
using a combo box in the form and then setting the query criteria to
[Forms]![FormName]![ComboBoxName]. However, if I do the same actions in
another query, but use a text box instead of a combo box with
[Forms]![FormName]![TextBoxName], no records are returned. I have ensured
that there is a record for the text I am entering. I am using Access 2007.

Thoughts?
 
M

Maurice

I guess that's where the trouble arises. Try placing Val in front of your
parameter. You are entering a number in a textbox and that will show output
as "1" where in your table the value might actually be 1.

so try: Val([Forms]![FormName]![TextBoxName])

this will make a number out of the text you enter in the textbox.

hth
--
Maurice Ausum


gisj said:
Thank you for your response.

The data type is text as set in the design view of the table (though it is
numbers that are actually entered into the field, this is merely an ID field
- no calculations are being performed). Is there somewhere else, like in the
form, the data type needs to be set?

Yes, I directly typed the value into the text box on the form. Since this
is a test database, I have made the values really simple such as 1, 2, 3...

Yes, the textbox is unbound.

Also, if I just use the simple approach of [enter message here] in the query
criteria, the query returns the correct records.

Maurice said:
Check the following:

- What's the datatype of the field which you've place the parameter on (is
it a text)
- Did you type the actual value in the textbox, when evaluating the data
entered has to be the exact same as the value in your recordset
- is the field an unbound field (no source control)

just a few thoughts

--
Maurice Ausum


gisj said:
Hello. I have been working with a test database to see how parameter queries
work, specifically having users use a form to provide the parameters before
implementing them in the main database. I am able to get this to work by
using a combo box in the form and then setting the query criteria to
[Forms]![FormName]![ComboBoxName]. However, if I do the same actions in
another query, but use a text box instead of a combo box with
[Forms]![FormName]![TextBoxName], no records are returned. I have ensured
that there is a record for the text I am entering. I am using Access 2007.

Thoughts?
 

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