Record auto fill form

C

cneeley

I would like to have the form complete a record upon entry
of the info in the Primary Key field. I know this has
been done many times and I am not able to recreate that
particular wheel.

My system is:
tblComplaintAddress, frmComplaintAddress, ComplaintAddress
ComplaintAddress is the primary key for the table as well
as the field name. After update of ComplaintAddress I
would like field ComplaintCity of the same path to
autofill.

Can someone give me code to do this?
 
S

Scott McDaniel

Do you want the record associated with ComplaintAddress to be found and
displayed? If so, you'd really have to have an unbound textbox (or combo
box) to allow your users to enter this data, and then do this in the
AfterUpdate event of that control:

Dim rs As DAO.Recordset

Set rs = Me.RecordsetClone

rs.FindFirst "ComplaintAddress=" & Me.ComplaintAddress

If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Else
msgbox "File Not found"
End If

Set rs = Nothing

If you want to autofill a City field based on the Address ... you'd have to
have a table that housed information re: what streets are in what city ...
you would then parse out the street name from your inputted text and perform
a DLookup on the table you built ... all-in-all a rather tricky prospect.
Far better to enter a Zip Code and have your City/State autofill.
 

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