SOOO Confused

dcavaiani

Registered User.
Local time
Today, 03:55
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)
 
Just curious, how is it your binding to the Order Header and why?
 
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,
 
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?
 
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.
 
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?
 
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
 
Call me an idiot! Can't see it. What is this step? 2) right-click on the subform control,
 
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.
 
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!
 
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

Back
Top Bottom