SQL query from table field

Enigmatic

New member
Local time
Today, 12:24
Joined
Apr 27, 2005
Messages
5
How do I take the value from a field in a form and input it into a SELECT SQL query ?
 
are you taking the value to be able to query on this value against a field within the table???
 
Yes.

Get the value of the field and somehow get it into a SQL query and search for that value within a field in a table.

That make sense ?
 
Yes.

Get the value of the field and somehow get it into a SQL query and search for that value within a field in a table.

That make sense ?
 
quite simple, use something like the following, if you post your table name and field name you want to query then i could write it for you.


SELECT field1.table1
FROM table1
WHERE (((field1.table1) Like "*" & [forms]![form1]![txtfield1] & "*"));

This will look for a value in the form and search for that value within the field

if you want an exact match then use
SELECT field1.table1
FROM table1
WHERE (((field1.table1)=[forms]![form1]![txtfield1]));


The [forms]![form1]![txtfield1] means. Leave the [forms] alone do not change this.

[forms1], is the name of your form which you are referencing to

[txtfield1], is the name of the control on your form that you are referencing to

I hope all this helps.

any issue let me know
 
Cool, that looks great thanks.

One more thing quickly, how do I place that code onto a button of some sort in my form so that when the button is pressed the query is run ?
 
what you want to do if you are getting into access use the wizards to help you then look at what they are doing, so you then are able to alter it better to suit your needs.

I not be funny, but the best way to learn...

Use the wizard in the form, and run a query from a command button

If you have any issues doing this then please say and i will paste some code for you, just let me know what your query is called.
 

Users who are viewing this thread

Back
Top Bottom