Creating a query that will search for first 3 letters of a postcod

S

Sarah08

Hi,
I have a database that is designed for an estate agent.
For part of my database i need a form that will let the user input the first
3 letters/numbers of a postcode eg: CH4 and the database will search for all
properties that start with those characters. Im so stuck, really need help!!
driving me mad!! Im not sure where to write anything within a query or what i
am supposed to use!!
Also, once I have done that, within that form i need a text box that will
allow the user to input the amount of bedrooms wanted and the database needs
to search for the postcode and the number of bedrooms that match. Hope you
understand! Please someone help me!

Sarah
 
G

George

Dear Sarah,

Create a form and add 2 textboxes (unbound objects) on it. In my example,
those are named txt1 and txt2. txt1 will be used by the user to enter the 3
first characters of the postcode, and txt2 to enter the number of bedrooms.

Then, create a query, based on your table having all the information, i.e.

SELECT tbl_Estate.Postcode, tbl_Estate.Bedrooms
FROM tbl_Estate
WHERE (((tbl_Estate.Postcode) Like [Forms]![Form1]![txt1] & "*") AND
((tbl_Estate.Bedrooms)=[Forms]![Form1]![Txt2]));

change tbl_Estate to yourTableName and txt1 and txt2 with your textboxes on
the form.

Then, create a command button on the form to run the query (you may create
also a report showing this information from your query).

Hope this will help,

GeorgeCY

Ο χÏήστης "Sarah08" έγγÏαψε:
 
S

Sarah08

How do I get the button to work??
I must sound stupid!



George said:
Dear Sarah,

Create a form and add 2 textboxes (unbound objects) on it. In my example,
those are named txt1 and txt2. txt1 will be used by the user to enter the 3
first characters of the postcode, and txt2 to enter the number of bedrooms.

Then, create a query, based on your table having all the information, i.e.

SELECT tbl_Estate.Postcode, tbl_Estate.Bedrooms
FROM tbl_Estate
WHERE (((tbl_Estate.Postcode) Like [Forms]![Form1]![txt1] & "*") AND
((tbl_Estate.Bedrooms)=[Forms]![Form1]![Txt2]));

change tbl_Estate to yourTableName and txt1 and txt2 with your textboxes on
the form.

Then, create a command button on the form to run the query (you may create
also a report showing this information from your query).

Hope this will help,

GeorgeCY

Ο χÏήστης "Sarah08" έγγÏαψε:
Hi,
I have a database that is designed for an estate agent.
For part of my database i need a form that will let the user input the first
3 letters/numbers of a postcode eg: CH4 and the database will search for all
properties that start with those characters. Im so stuck, really need help!!
driving me mad!! Im not sure where to write anything within a query or what i
am supposed to use!!
Also, once I have done that, within that form i need a text box that will
allow the user to input the amount of bedrooms wanted and the database needs
to search for the postcode and the number of bedrooms that match. Hope you
understand! Please someone help me!

Sarah
 

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