air code, no error code
in the city_afterUpdate event
dim rs as recordset
dim strsql as string
strsql = "SELECT zipCode FROM tblCityZip WHERE city = '" & city & "'"
set rs = currentdb.openrecordset(strsql)
if (not(rs.eof)) then
zip = rs!zip
end if
rs.close
set rs = nothing
same thing in the zip_afterUpdate event
and in the form_afterUpdate event
dim rs as recordset
dim strsql as string
strsql = "SELECT zipCode FROM tblCityZip WHERE city = '" & city & "'"
set rs = currentdb.openrecordset(strsql)
if (not(rs.eof)) then
' if zip is changed, could give user the choice of updating the table
rs.edit
rs!zip = zip
rs.update
else
rs.add
rs!city = city
rs!zip = zip
rs.update
end if
rs.close
set rs = nothing
"Kristof" <kr*************@pandora.be> wrote in message news:<06**********************@phobos.telenet-ops.be>...
Hello,
I have a question about relations.
I have a table with city's and zipcodes. I need to insert these in an other
table when filling in a form. So far all works fine. But now i want it to
automatically fill in the city when i fill in the zipcode or vice versa. How
do I do this?
Greetings,
Kristof