Page 1 of 2

"Add Record" from SubForm and populating field

Posted: Wed Nov 20, 2013 7:19 am
by fester
Hi,

I have followed the steps on the youtube vid to configure the default values in an edit form Lookup.

I.E.
Subform's "Default Filter for Browse Screen" => #ClientID#
Subform's filtering works perfectly.

Click "Add Record" button...
When I set Default Value SQL for a Lookup to "select '#browse_filter#' ", I get the value=0, even though the value should be 2127827375.
I set the Default Value SQL for a Text Box to "select '#browse_filter#'" and I get out "#browse_filter#".

I have fought with this for about a day and I am at my wits end. I am obviously missing something stupid.

Help please?

Matt.

Re: "Add Record" from SubForm and populating field

Posted: Wed Nov 20, 2013 7:34 pm
by massiws
fester,
maybe something wrong in subform and/or lookup field settings.
Can you post some screenshots?

Max

Re: "Add Record" from SubForm and populating field

Posted: Wed Nov 20, 2013 11:52 pm
by fester
Subform
nu_subform.JPG
Lookup
nu_lookup.JPG

The subform exists on the (Wizard) ClientTable form.

Re: "Add Record" from SubForm and populating field

Posted: Thu Nov 21, 2013 1:09 am
by massiws
fester,
the few settings you show seems correct.
Try to check the value set in Lookup object -> Field Name field: this is the FK (in the subform QualificationsTable2) that point to PK in ClientTable table.

Re: "Add Record" from SubForm and populating field

Posted: Thu Nov 21, 2013 6:00 am
by fester
The Lookup Object
nuForm1.JPG
nuForm2.JPG
Client Form
nuForm3.JPG
nuForm4.JPG
Subform
nuForm5.JPG
Anything else you would like to see?

Re: "Add Record" from SubForm and populating field

Posted: Thu Nov 21, 2013 10:13 am
by massiws
fester,
I think the problem could be in a wrong configuration of the Lookup object: in lookup object -> All tab -> Code Field you should insert the name of a real ClientTable field (have a look at this post).

Re: "Add Record" from SubForm and populating field

Posted: Mon Nov 25, 2013 12:12 am
by fester
I have the All - Field Name and the Lookup - Code Field set to the ID of the table.

The ID field is an autoincrementing int - will that possibly be the issue?

Re: "Add Record" from SubForm and populating field

Posted: Mon Nov 25, 2013 12:41 am
by fester
Viewing a value from the subform i get
<input name='ClientID' id='ClientID' type='hidden' value='2127827375'>

However on the Add Record button press I get
<input name='ClientID' id='ClientID' type='hidden' value='0'>



I am missing something in bringing the FK from the subform to the popup Add Record form. I just can't work out what.

Re: "Add Record" from SubForm and populating field

Posted: Mon Nov 25, 2013 11:07 pm
by massiws
fester,
fester wrote:The ID field is an autoincrementing int - will that possibly be the issue?
have a look at this wiki.

The Field Name in the lookup object is the name of the field where the value of the lookup has to be saved; make sure that this FK is the same size and type as the PK of the lookup table.

Re: "Add Record" from SubForm and populating field

Posted: Mon Nov 25, 2013 11:48 pm
by fester
The ClientTable PK and the QualificationsTable FK match, and are correct from a DB point of view.

I'm stumped.

I have spoken to customer and convinced them out of this requirement. Something silly is happening and I have burnt too much time fighting with it :(