How do I sync with drop-down list?

  • Thread starter Thread starter Cuong Fan
  • Start date Start date
C

Cuong Fan

Hi,

I'm creating a data entry form. I am using only 1 table.
It has names of schools with addresses and phone numbers
for each school and a field for yes or no.

I created a drop-down list for the schools on the form but
when you select a different school, the other fields such
as address and phone number remain unchanged. How Do I
link the others fields on the form to my drop-down list so
when I select a school, the related information appears
with it? Thank you for your help.
 
It seems that you want to do is synchronize a drop-down list with the form's
current record.

If that is so then use this example from the Help - RecordsetClone Property
and replace your fields/combo box names with theirs:
The next example uses the RecordsetClone property and the Recordset object
to synchronize a recordset's record with the form's current record. When a
company name is selected from a combo box, the FindFirst method is used to
locate the record for that company and the Recordset object's DAO Bookmark
property is assigned to the form's Bookmark property, causing the form to
display the found record.

Sub SupplierID_AfterUpdate()
Dim rst As Recordset
Dim strSearchName As String

Set rst = Me.RecordsetClone
strSearchName = Str(Me!SupplierID)
rst.FindFirst "SupplierID = " & strSearchName
If rst.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
 
Back
Top