K guys this is driving me mad - the dlookup query is working fine... it will find details for the first record in the form. however it gets stuck on that one whe ni go through the records.
I have different dlookups working at the same time properly and changing as I go through records. however with the lookup of the addresses table it is getting stuck.
Whats wrong with it? I have looked at the code and preperties of the box but can't see where its gonig wrong.
Here is the code:
Private Sub Form_Current()
Forms!Applicantsdata1![Title] = DLookup("Title", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![town] = DLookup("Address_Line_2", "tblStudentAddresses_Current_All", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![town1] = DLookup("town", "tblStudentAddresses_Current_All", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Mobile] = DLookup("mobile", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![knownas] = DLookup("Known_As", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Course] = DLookup("Course_Title", "tblStudents_Courses_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![HomePostcode] = DLookup("Postcode", "tblStudentAddresses_Current_All", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Sex] = DLookup("Sex", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![DOB] = DLookup("DOB", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Nation] = DLookup("NatDesc", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Ethnicity] = DLookup("EO", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
End Sub
I have different dlookups working at the same time properly and changing as I go through records. however with the lookup of the addresses table it is getting stuck.
Whats wrong with it? I have looked at the code and preperties of the box but can't see where its gonig wrong.
Here is the code:
Private Sub Form_Current()
Forms!Applicantsdata1![Title] = DLookup("Title", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![town] = DLookup("Address_Line_2", "tblStudentAddresses_Current_All", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![town1] = DLookup("town", "tblStudentAddresses_Current_All", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Mobile] = DLookup("mobile", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![knownas] = DLookup("Known_As", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Course] = DLookup("Course_Title", "tblStudents_Courses_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![HomePostcode] = DLookup("Postcode", "tblStudentAddresses_Current_All", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Sex] = DLookup("Sex", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![DOB] = DLookup("DOB", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Nation] = DLookup("NatDesc", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
Forms!Applicantsdata1![Ethnicity] = DLookup("EO", "tblStudents_Current", "Person_Code = (Forms!Applicantsdata1!Person_codelbl)")
End Sub