linking forms problem

Davidp

New member
Local time
Today, 10:05
Joined
Apr 6, 2012
Messages
8
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
 
Have just got this to work on existting records but adding new records gives a run time error 80020009 'cant assign a value to this object.' with the debug showing an error in the lastt line.

[Forms]![ClientFormNew].ClientUPRN = [Forms]![ClientFormAdd].UPRN

now I'm confused
 
If Me.NewRecord Then

DoCmd.OpenForm "ClientFormNew", acNormal, , , acFormAdd

still using the above? Look up OpenForm in the docs and count the commas
 
still using the above? Look up OpenForm in the docs and count the commas
Thanks you for that but reducing the number of commas still gives me the 80020009 'cant assign a value to this object' error. So something else is wrong.
Cheers, David
 
"reducing"? Try to count, again.

"Cannot assign a value ..." is normally triggered by attempts to assign a value to a control that has an expression specified as control source.
 

Users who are viewing this thread

Back
Top Bottom