Hi All
As a newbie, I have what might be a beginners problem
I have created a form to interrogate our database and display all records without a unique building reference code OSAPR. The form has two subforms which hold details of domestic and occupational addresses and OSAPR codes. Only one subform should be displayed at any one time.
The idea is that when a new record number (primary key called holding_id) is on the form, a bit of code runs which looks at the txttype to determine whether it is a D (domestic address) or O (occupational address).
The two subforms are set as visible = no, so they only become visible under the above circumstances.
I then have a matched and an unmatched button to update the table behind the form.
I have tried various codes to sort out the two subforms, currently I have:
Private Sub txtHolding_id_GotFocus()
If Me.txtType = D Then
Me.dbSAddress_subformD.Visible = True
Exit Sub
If Me.txtType = O Then
Me.dbSAddress_subformO.Visible = True
Exit Sub
End If
End Sub
however not only is the domestic subform visible at all times, regardless of the txttype code being D or O, but I also get an error message :
"Compile error: Method or data member not found"
Please advise - what am I doing wrong?
Thanks, Kate
As a newbie, I have what might be a beginners problem
I have created a form to interrogate our database and display all records without a unique building reference code OSAPR. The form has two subforms which hold details of domestic and occupational addresses and OSAPR codes. Only one subform should be displayed at any one time.
The idea is that when a new record number (primary key called holding_id) is on the form, a bit of code runs which looks at the txttype to determine whether it is a D (domestic address) or O (occupational address).
The two subforms are set as visible = no, so they only become visible under the above circumstances.
I then have a matched and an unmatched button to update the table behind the form.
I have tried various codes to sort out the two subforms, currently I have:
Private Sub txtHolding_id_GotFocus()
If Me.txtType = D Then
Me.dbSAddress_subformD.Visible = True
Exit Sub
If Me.txtType = O Then
Me.dbSAddress_subformO.Visible = True
Exit Sub
End If
End Sub
however not only is the domestic subform visible at all times, regardless of the txttype code being D or O, but I also get an error message :
"Compile error: Method or data member not found"
Please advise - what am I doing wrong?
Thanks, Kate