autopopulate parameter value with value from a text box

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

Guest

Is there a way to autopopulate the value in a parameter query with the
information in a text box found on a form?

I have a form with a command button that brings up a parameter query. The
information to be entered as the parameter value is the same information in
the text box on my form. Instead of typing the parameter value, I'd like the
text field value to automatically populate the parameter query.

Thanks,
 
Hi,
why so complicated...you can just directly reference the value in your
control in the criteria of the query field instead:

[Forms]![YourForm]![YourControl]

This way you won't need to input parameter box and the value of the form
control will be used at query run.
HTH
Good luck
 
Awesome!! It worked! Can I take it one step further?

If my query comes back with results, how would I go about activating a check
box?

I set the query to be opened by a command button. I would think that I
should write an IF statement within the click event of my command button but
I'm not sure where to start.


Many thanks!!
--
Tina


freakazeud said:
Hi,
why so complicated...you can just directly reference the value in your
control in the criteria of the query field instead:

[Forms]![YourForm]![YourControl]

This way you won't need to input parameter box and the value of the form
control will be used at query run.
HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Tina said:
Is there a way to autopopulate the value in a parameter query with the
information in a text box found on a form?

I have a form with a command button that brings up a parameter query. The
information to be entered as the parameter value is the same information in
the text box on my form. Instead of typing the parameter value, I'd like the
text field value to automatically populate the parameter query.

Thanks,
 
Hi,
use the dcount function after you run the query:

If Dcount("*","YourQueryName") > 0 Then
Me.YourCheckbox = True
Else
Me.YourCheckbox = False
End If

HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Tina said:
Awesome!! It worked! Can I take it one step further?

If my query comes back with results, how would I go about activating a check
box?

I set the query to be opened by a command button. I would think that I
should write an IF statement within the click event of my command button but
I'm not sure where to start.


Many thanks!!
--
Tina


freakazeud said:
Hi,
why so complicated...you can just directly reference the value in your
control in the criteria of the query field instead:

[Forms]![YourForm]![YourControl]

This way you won't need to input parameter box and the value of the form
control will be used at query run.
HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Tina said:
Is there a way to autopopulate the value in a parameter query with the
information in a text box found on a form?

I have a form with a command button that brings up a parameter query. The
information to be entered as the parameter value is the same information in
the text box on my form. Instead of typing the parameter value, I'd like the
text field value to automatically populate the parameter query.

Thanks,
 
This is really great. Can I ask another question?

How do I check for a null value. Some of the text boxes are empty. So if I
run the query against it, it brings back everyone. Is there a way around
this?

Thanks,

--
Tina


freakazeud said:
Hi,
use the dcount function after you run the query:

If Dcount("*","YourQueryName") > 0 Then
Me.YourCheckbox = True
Else
Me.YourCheckbox = False
End If

HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Tina said:
Awesome!! It worked! Can I take it one step further?

If my query comes back with results, how would I go about activating a check
box?

I set the query to be opened by a command button. I would think that I
should write an IF statement within the click event of my command button but
I'm not sure where to start.


Many thanks!!
--
Tina


freakazeud said:
Hi,
why so complicated...you can just directly reference the value in your
control in the criteria of the query field instead:

[Forms]![YourForm]![YourControl]

This way you won't need to input parameter box and the value of the form
control will be used at query run.
HTH
Good luck
--
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


:

Is there a way to autopopulate the value in a parameter query with the
information in a text box found on a form?

I have a form with a command button that brings up a parameter query. The
information to be entered as the parameter value is the same information in
the text box on my form. Instead of typing the parameter value, I'd like the
text field value to automatically populate the parameter query.

Thanks,
 

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

Back
Top