I have a small database with three tables as follows:
tblPerson
PersonID
LastName
FirstName
tblOffence
OffenceID
Offence
tblPersonsOffences
PersonsOffencesID
PersonID
Offence
DateofOffence
ReportedBy
Remarks
Now in the form frmPersonsOffences, I have created two unbound textboxes, so that when I type the PersonID, the name and surname will be displayed to better identify the person. What is the best way to put the name and surname in these two textboxes? I was thinking to create an SQL statement such as "SELECT tblPerson.LastName FROM tblPerson WHERE tblPerson.PersonID = [Forms]![frmPersonsOffences]![txtPersonID] but I am not sure where I should put this code.
Thanks in advance for your help.
tblPerson
PersonID
LastName
FirstName
tblOffence
OffenceID
Offence
tblPersonsOffences
PersonsOffencesID
PersonID
Offence
DateofOffence
ReportedBy
Remarks
Now in the form frmPersonsOffences, I have created two unbound textboxes, so that when I type the PersonID, the name and surname will be displayed to better identify the person. What is the best way to put the name and surname in these two textboxes? I was thinking to create an SQL statement such as "SELECT tblPerson.LastName FROM tblPerson WHERE tblPerson.PersonID = [Forms]![frmPersonsOffences]![txtPersonID] but I am not sure where I should put this code.
Thanks in advance for your help.