Ordering System, Form with Subform (1 Viewer)

navi95

Registered User.
Local time
Yesterday, 23:25
Joined
Jan 3, 2013
Messages
59
Hi,

Im creating a database for a pizza business in Germany so please excuse the german Field names lol. So ive started it, created my many to many relationships and also created a Form with 2 subforms, one to display the customer info and one to actually take the order (datasheet view)

I can type in the telephone of a customer and the details comes up etc, thats fine. But when I try to actually place items on the order, it wont let me due to the fact that in the Junction table, the value of the order ID stays blank


Heres a look at my relationships:


Ive read something about events when opening and closing forms, im not sure if thats what i need though. I was thinking of maybe making the order in two stages, locate Customer details and then open another form using a button to itemise the order.

Any thoughts??

Thanks :)
 

RuralGuy

AWF VIP
Local time
Today, 00:25
Joined
Jul 2, 2005
Messages
13,826
Re: Ordering System, Form with subform

Why not use an AutoNumber as the Primary Key field of the "orders" table. The other two fields do not need to be a Primary Key to keep them unique.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 07:25
Joined
Feb 19, 2013
Messages
16,668
thread moved to forms - sample databases section is for the posting of samples for use by others
 

navi95

Registered User.
Local time
Yesterday, 23:25
Joined
Jan 3, 2013
Messages
59
Re: Ordering System, Form with subform

Why not use an AutoNumber as the Primary Key field of the "orders" table. The other two fields do not need to be a Primary Key to keep them unique.

I did try that at some point, but I still had the issue that "bestellnummer" in the subform wasnt being updated with the "bestellnummer" created when opening the form up.
 

RuralGuy

AWF VIP
Local time
Today, 00:25
Joined
Jul 2, 2005
Messages
13,826
Did you have that field as one of your LinkMaster/ChildFields?
 

navi95

Registered User.
Local time
Yesterday, 23:25
Joined
Jan 3, 2013
Messages
59
Which field are you referring to?
if the bestellnumber field, then yes, I had a one to many relationship for that as I need to have several ordered items on the bill
 

RuralGuy

AWF VIP
Local time
Today, 00:25
Joined
Jul 2, 2005
Messages
13,826
The SubFormControl, not the SubForm but the control on the MainForm that displays the SubForm, has two properties called LinkMasterFields and LinkChildFields. These are the fields that the SubFormControl will keep updated for you. Just having a Relationship is not sufficient to get them updated.
 

navi95

Registered User.
Local time
Yesterday, 23:25
Joined
Jan 3, 2013
Messages
59
So I have managed to get around my issue, I have seperated the form, so now the subform appears in a seperate form.
I then set the default value in the field on the second form as "=[Formulare]![Bestellung]![Bestellnummer]" which works nicely as the first form is still open in the background :)
 

RuralGuy

AWF VIP
Local time
Today, 00:25
Joined
Jul 2, 2005
Messages
13,826
That's great! As you know, there many ways to skin a cat. :D
 

Users who are viewing this thread

Top Bottom