Record auto fill form

  • Thread starter Thread starter cneeley
  • Start date Start date
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?
 
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.
 
Back
Top