Get street and city via postal code in a form

t.reacq

New member
Local time
Today, 20:57
Joined
Jan 12, 2011
Messages
2
First of all, sorry for my bad English, as I’m Dutch.

I am making a form where you can add new customers.

When the postal code and street number are filled in in the respective textboxes, I want that the form automatically (or with the push of a button) fills the street name (STRAAT) and the city (WOONPLAATS), also in their text boxes. These information can be retrieved from the table POSTCODES.

The SQL query would look like this:
SELECT STRAAT, WOONPLAATS
FROM POSTCODES
WHERE form.postcode = POSTCODES.Postcode

The italic is probably wrong, but it's only to illustrate what I want to do.

I want to somehow assign the results of the SQL query to the text boxes. But I haven’t got a clue how to do this.

The postal codes, street names and cities are stored in the table POSTCODES (postal codes) and all customer information like name etc. and the postal code (but NOT city and street) are stored in the table KLANTEN (customers).

I hope my story is understandable.
 
Look up or have a search for "OpenRecordset", that should bring you some good steps closer to where you want to go.

Groeten uit Amsterdam
 
I've searched for OpenRecordset, but the explanation on Microsoft's site is very vague and examples given on other sites do not work properly.
Is it possible for you (or anyone else ofcourse) to make an easy, working example?
I am using Access 2010.
 
Keep your Textbox to Straat Number

You could create a Combibox to lookup the Postcode with three fields:

Postcode column(0)
Straat column(1)
Woonplaats column(2)

By using the column facility and extract the information Straat and Woonplaats.

Your SQL WHERE statement is the wrong way round eg:
WHERE POSTCODES.Postcode=[Forms]![KLANTEN]![Postcode]

Simon
 

Users who are viewing this thread

Back
Top Bottom