Hi All,
I am working for a UK charity which has an Access 2007 database populated with over 1 million property addresses in a table called ‘residential’. Each address has a unique number (UPRN) and this is the primary key. I have a related table called ‘clients’ which fills up with information related to each address. The UPRN links to a numeric field in clients called ClientUPRN.
Users open a form called ClientFormAdd which allows searching for a property. Once found the user clicks on a button which opens up a form called ClientFormNew. Well I am new to coding and I can’t get the code to work. This is supposed to open the new form to show data off the ‘ClientFormAdd’ form and the client table. If the record is not new it should show the existing record.
Unfortunately I just get a form with none of the fields from the ClientFormAdd populated.
Any advice would be much appreciated
Many thanks, David
Hers is the button code.
Private Sub Command44_Click()
If Me.NewRecord Then
DoCmd.OpenForm "ClientFormNew", acNormal, , , acFormAdd
[Forms]![ClientFormNew].ClientUPRN = [Forms]![ClientFormAdd].UPRN
Else
'open form in Edit mode if old record
DoCmd.OpenForm "ClientFormNew", , , "ClientUPRN = " & Me.UPRN
[Forms]![ClientFormNew].ClientUPRN = [Forms]![ClientFormAdd].UPRN
End If
End Sub
I am working for a UK charity which has an Access 2007 database populated with over 1 million property addresses in a table called ‘residential’. Each address has a unique number (UPRN) and this is the primary key. I have a related table called ‘clients’ which fills up with information related to each address. The UPRN links to a numeric field in clients called ClientUPRN.
Users open a form called ClientFormAdd which allows searching for a property. Once found the user clicks on a button which opens up a form called ClientFormNew. Well I am new to coding and I can’t get the code to work. This is supposed to open the new form to show data off the ‘ClientFormAdd’ form and the client table. If the record is not new it should show the existing record.
Unfortunately I just get a form with none of the fields from the ClientFormAdd populated.
Any advice would be much appreciated
Many thanks, David
Hers is the button code.
Private Sub Command44_Click()
If Me.NewRecord Then
DoCmd.OpenForm "ClientFormNew", acNormal, , , acFormAdd
[Forms]![ClientFormNew].ClientUPRN = [Forms]![ClientFormAdd].UPRN
Else
'open form in Edit mode if old record
DoCmd.OpenForm "ClientFormNew", , , "ClientUPRN = " & Me.UPRN
[Forms]![ClientFormNew].ClientUPRN = [Forms]![ClientFormAdd].UPRN
End If
End Sub