Hi everyone, here is my latest challenge. I need to look up values in a table, then store those values into a control on a subform. So, for each record in tblIndustry I need to store the value of the field 'industry'. My code doesn't work if there are multiple industry records for a contact ... because all the values are stored into the same control. Could someone tell me how to "reference" mutiple occurrences in the subform? Here is my code so far ... Thanks!
' find industry records from source contact
strSQL = "SELECT * FROM tblIndustry WHERE (((tblIndustry.in_contactID)=" & lngContactID & "));"
Set myRS = myDB.OpenRecordset(strSQL)
' add new industry values to subform
myRS.MoveFirst
Do Until myRS.EOF
Forms![frmContact]![frmContactIndustry_Sub]![List_industry].Value = myRS!industry
myRS.MoveNext
Loop
myRS.Close
Set myRS = Nothing
' find industry records from source contact
strSQL = "SELECT * FROM tblIndustry WHERE (((tblIndustry.in_contactID)=" & lngContactID & "));"
Set myRS = myDB.OpenRecordset(strSQL)
' add new industry values to subform
myRS.MoveFirst
Do Until myRS.EOF
Forms![frmContact]![frmContactIndustry_Sub]![List_industry].Value = myRS!industry
myRS.MoveNext
Loop
myRS.Close
Set myRS = Nothing