SOOO Confused (1 Viewer)

dcavaiani

Registered User.
Local time
Today, 11:36
Joined
May 26, 2014
Messages
385
I finally found a way to replicate a customer code on the detail lines of an Invoice slip/receipt from a Supplier (say Home Depot).

I used the DLAST to get the customer to replicate from the prior line of the Detail table.

However, when I want to create a brand NEW SLIP and I am in the header (with the blank subform detail displayed below), I get the runtime error 3075 "syntax error (missing operator) in query expression '[recordid]='.

Recordid is the same named linking field of the Order Header to the Order Detail.

My Code in the Form_Current of the Detail subform is:

If Me.NewRecord Then
Customer = DLast("customer", "supplierinvoicedtl", "[recordid] = " & Me.RecordID)
 

burrina

Registered User.
Local time
Today, 11:36
Joined
May 10, 2014
Messages
972
Just curious, how is it your binding to the Order Header and why?
 

MarkK

bit cruncher
Local time
Today, 09:36
Joined
Mar 17, 2004
Messages
8,181
You do not have to set this in code, much less from the previous record in a subform. Rather, the foreign key field linking a subform record--including a new one--to the primary key of the main form record can be automatic if you set the LinkMasterFields and LinkChildFields properties of the subform control. If you set those properties then linking and inserting will be automatic without any code.

Hope this helps,
 

dcavaiani

Registered User.
Local time
Today, 11:36
Joined
May 26, 2014
Messages
385
You do not have to set this in code, much less from the previous record in a subform. Rather, the foreign key field linking a subform record--including a new one--to the primary key of the main form record can be automatic if you set the LinkMasterFields and LinkChildFields properties of the subform control. If you set those properties then linking and inserting will be automatic without any code.

Hope this helps,

I think I have have linking set, but I have not been sure how to CHECK it?
 

MarkK

bit cruncher
Local time
Today, 09:36
Joined
Mar 17, 2004
Messages
8,181
On the "Data" tab of the subform control's datasheet in design view, look for the LinkMasterFields and LinkChildFields properties. Those should be the names of the controls on the main form and subform respectively. Those controls expose the main form primary key, and the subform's foreign key respectively.
 

dcavaiani

Registered User.
Local time
Today, 11:36
Joined
May 26, 2014
Messages
385
You do not have to set this in code, much less from the previous record in a subform. Rather, the foreign key field linking a subform record--including a new one--to the primary key of the main form record can be automatic if you set the LinkMasterFields and LinkChildFields properties of the subform control. If you set those properties then linking and inserting will be automatic without any code.

Hope this helps,

Can't find it? Is that available in 2002?
 

MarkK

bit cruncher
Local time
Today, 09:36
Joined
Mar 17, 2004
Messages
8,181
Yeah,
1) put the form in design view,
2) right-click on the subform control,
3) click "properties" in the popup menu and the Property Sheet opens,
4) click on the "Data" tab, and
5) Find the LinkMasterFields and LinkChildFields properties
 

dcavaiani

Registered User.
Local time
Today, 11:36
Joined
May 26, 2014
Messages
385
Call me an idiot! Can't see it. What is this step? 2) right-click on the subform control,
 

MarkK

bit cruncher
Local time
Today, 09:36
Joined
Mar 17, 2004
Messages
8,181
A subform is a form on top of another form. In design view, that subform is a rectangle, usually white, that defines the space where that subform will appear when the parent form opens. That rectangle is a control, called a "subform control," that "hosts" the subform and mediates the relationship between the main form and the subform. In number 2), above, the instruction is that you right-click on that space, which has the effect of causing a popup menu to appear.
 

dcavaiani

Registered User.
Local time
Today, 11:36
Joined
May 26, 2014
Messages
385
Whew - found it - I was in the subform itself to start and nothing showed up there. Yes - the recordid is in each of those 'links'. Thanks for your patience!
 

MarkK

bit cruncher
Local time
Today, 09:36
Joined
Mar 17, 2004
Messages
8,181
Phew, so relieved. Not sure how I was going to get more specific after that, LOL. :)

But yeah, you should be able to synchronize your forms and subforms very easily--if the parent and child tables are adequately linked--with the properties I mentioned. Record additions, and filters as you change records in the parent/main form, should just happen without code.

Keep me posted on how this works out for you,
 

Users who are viewing this thread

Top Bottom