Auto update of form feilds ???? ?? ? ? ?

paulmcdonnell

Ready to Help
Local time
Today, 08:39
Joined
Apr 11, 2001
Messages
167
Hi guys,

I'm trying to update a group of fields on a form based on the value I select from a combo box. I want to select the company from my combo box then I want the five form field below it to automatically fill with the five lines of it's address stored in the table.

Just can't quite seem to get this one right...
 
You can use an event procedure after update in the drop down box. An example of this procedure is:
Dim dbf As Recordset, qdf As QueryDef, strSQL As String
strSQL = "SELECT * FROM [Purchases] WHERE " _
& "[Product ID] = " & Me![Product ID]
Set dbf = CurrentDb.OpenRecordset(strSQL)
Me![Product Name] = dbf![Product Name]
Me![List Price] = dbf![List Price]
Me![Per Gallon] = dbf![Per Gallon]
Me![Per Quart] = dbf![Per Quart]
Me![Per Pint] = dbf![Per Pint]
Me![Per Ozs] = dbf![Per Ozs]
Me![Per ton] = dbf![Per ton]
Me![Per Lbs] = dbf![Per Lbs]
Me![Per Acre] = dbf![List Price]

End Sub
This updates fields determined by Product ID.
 

Users who are viewing this thread

Back
Top Bottom