Query database with Where statement is string in text box

N

NikV

This might be a newbie question but any help would be great. I have a text
box with a query button next to it. The user will put the Account number in
the text box. After that the user hits the button to query. I want InfoPath
to query the database with the account number in the text box. Can this be
done without using code? If code is a must then please help me in Visual
Basics. Please help. Thanks!
 
A

Andrej

Hello NikV,

as i understand you created a form based on a database?
so you have query fields in your datasource.
you can use this query fields to run a query. you can set a property of a
pushbutton control to run the query against the database.



cu
 
N

NikV

That's correct, but how do you have the query filter out only what the user
types in the text box? For example i have a account number. The user puts
in the account number in the text box and clicks query....how do I get
infopath to give me the record that is associated with this account number.
Does that make sense? Thank you for your help!
 
A

Andrej

Sorry, i do not understand the problem:

in your datasource you have following picture:
myFields
queryFields
dataFields

under the node queryFileds you have all Field which you can use to run a
query against the database.

put a field for account number from query node in your form
put a button whit property "run query" in your form

put the first childnode of dataFileds in your form as "section with
controls" (datasection)

preview the form
put a valid account number into your queryfield you inserted into the form
push the button.

if there is a record it will be show in the data section

i hope i could help you
 

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