populate a field with a vba

icemonster

Registered User.
Local time
Today, 10:04
Joined
Jan 30, 2010
Messages
502
hey, so i have this code:

Code:
Function startStudentPresAddress()
strStartSql2 = "SELECT qry_address_student1.id_student_address, qry_address_student1.studadd_id_student, " _
             & "qry_address_student1.studadd_id_address, qry_address_student1.address_street1, " _
             & "qry_address_student1.address_street2, qry_address_student1.address_city, qry_address_student1.address_state, " _
             & "qry_address_student1.address_zipcode, qry_address_student1.address_country, " _
             & "qry_address_student1.address_id_address_type FROM qry_address_student1 "
             
strWhereSql2 = "WHERE qry_address_student1.studadd_id_student = " & Forms![frm_main_menu]![lstStudent] & " "

strWhereSql2 = strWhereSql2 & "AND qry_address_student1.address_id_address_type = 1 "

strSQL2 = strStartSql2 & strWhereSql2

With Me.lstpresadd
       .RowSource = strSQL2
       .Value = Null
End With
Me.txtpresstreet1 = address_street1
End Function

my goal with this code is to fill a field using the queried sql, this code is wrong so is there anyway you guys can teach me the right way to pull the records?
 
This data apparently already exists in at least one table, so is there a reason why you want to redundantly store it in a second table as well? Or are you just trying to display it in an unbound text box?
 

Users who are viewing this thread

Back
Top Bottom