Fill fields from table

tjones

Registered User.
Local time
Today, 04:51
Joined
Jan 17, 2012
Messages
199
I am attempting to fill fields in the Recomm form (to Recomm table) from the Institutions table. I only need to fill certain fields on the form if the record is contained in the institution table (See attached graphic)

I am not sure that I am doing this right (do I need to add the beginning of the institution name in Organization field or just click on the institution link

Private Sub Institutions_Click()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset(Institutions, dbOpenSnapshot)
rst.FindFirst ("[Institution] = " & Institution.Value)
Institution.Value = rst.Organization
Address.Value = rst.Address
City.Value = City
State.Value = State
ZIP.Value = ZIP
Country.Value = Country
Set rst = CurrentDb.OpenRecordset(Institutions)
End Sub

The code keeps hanging on "institution.value=rst.Organization" line :confused:
 

Attachments

  • recommend-inst.jpg
    recommend-inst.jpg
    61 KB · Views: 91
The code keeps hanging on "institution.value=rst.Organization" line
Try changing this to
Code:
institution.value=rst!Organization
The difference is that .Organization refers to a non-existent propery of the query, whereas !Organization refers to a field of the query.
You need to make the change to all of the query field references in your code.
I notice you re-open the recordset at the end of the code - why is this? If you are looking to get the updated content, then use
Code:
rst.Reqery
although it would have no effect in this case because the recordset content would not have changed in your code.
 

Users who are viewing this thread

Back
Top Bottom