How to create an unbound Subform related to an unbound Text Box

V

VRakesh

Hello,
Can somebody help me. I wish to make an a bound/unbound Form and
bound/unbound subform. This is needed for creating an GRR entry form with
the Receipt details on the header and part, qty details in subform along with
a button in the bottom to finally raise a auto generated document number to
corelate the header table (Order header) to detail table (Order Detail)
 
B

BruceM via AccessMonster.com

You have the advantage of seeing your database. For those who cannont, I
think more description will be needed of the database's purpose and structure
before it is possible to provide a meaningful answer. For one thing, what is
a bound/unbound form?
 
V

VRakesh via AccessMonster.com

BruceM said:
You have the advantage of seeing your database. For those who cannont, I
think more description will be needed of the database's purpose and structure
before it is possible to provide a meaningful answer. For one thing, what is
a bound/unbound form?

Thanks for responding Bruce,
I have two table One is GRR_Header and the other is GRR_Detail. In addition i
also wish to generate an autonumber using another table GRR_Sr. I therefore
made a form with Header data going to the GRR_Header table whereas other
details like part no and qty going to the GRR_Detail table. I have in-
corporated the header in the Main form, while the details in the Subform (as
one supplier Invoice may have many Parts) and the autonumber generation
happens after on the field (text box ) in the main form is updated and the
user moves to the Subform for part entry. My query is instead of using
AfterUpdate can i initiate the process of generating autonumbers only after
pressing a button placed in the footer. My problem is since both the table
are related as a file [GRN_No] has primary key in Header it would not let me
move to detail without any data in [GRN_No] (which i wish to generate only
after pressing the button)
Pls help me...
 
B

BruceM via AccessMonster.com

The main form record is saved when you enter the subform. If there is a
required field in the main form's Record Source you need a value for that
field before you save the record. I don't know where After Update fits into
the picture, but if you are referring to the form's After Update event that
also is too late to generate a number in a required field, as the record
needs to be saved before After Update will run. Further, if you are using an
autonumber field you cannot control when a value is placed in that field.

Why do you want to wait until the user is in the subform?
You have the advantage of seeing your database. For those who cannont, I
think more description will be needed of the database's purpose and structure
[quoted text clipped - 7 lines]
Thanks for responding Bruce,
I have two table One is GRR_Header and the other is GRR_Detail. In addition i
also wish to generate an autonumber using another table GRR_Sr. I therefore
made a form with Header data going to the GRR_Header table whereas other
details like part no and qty going to the GRR_Detail table. I have in-
corporated the header in the Main form, while the details in the Subform (as
one supplier Invoice may have many Parts) and the autonumber generation
happens after on the field (text box ) in the main form is updated and the
user moves to the Subform for part entry. My query is instead of using
AfterUpdate can i initiate the process of generating autonumbers only after
pressing a button placed in the footer. My problem is since both the table
are related as a file [GRN_No] has primary key in Header it would not let me
move to detail without any data in [GRN_No] (which i wish to generate only
after pressing the button)
Pls help me...
 
V

VRakesh via AccessMonster.com

BruceM said:
The main form record is saved when you enter the subform. If there is a
required field in the main form's Record Source you need a value for that
field before you save the record. I don't know where After Update fits into
the picture, but if you are referring to the form's After Update event that
also is too late to generate a number in a required field, as the record
needs to be saved before After Update will run. Further, if you are using an
autonumber field you cannot control when a value is placed in that field.

Why do you want to wait until the user is in the subform?
[quoted text clipped - 17 lines]
after pressing the button)
Pls help me..

Hello Bruce,
That is exact the autonumbers are in-fact generated as i use the After Update
event which i have to use in the main form, but you see the problem is my
user is quite a person. At time he may simply close the form without putting
any data in the subform which will result in scrap in my table in addition to
lose of an autonumber...So what i wish is that the user when is very sure
that he has entered the right data should click the button and the table
should be updated....
You see the user may simply close the form before updating the
 
L

Larry Linson

Records are saved when the form is closed, when you move to a different
record, or when you move into a subform. Further, once the Autonumber seed
is incremented for the Autonumber field (and you may not yet see the
Autonumber in the field), that seed has been increased and won't be
available even if you cancel the saving of the record.

If you are using a form/subform, and the subform refers back to an
Autonumber unique ID, you cannot do what you want, because all required
fields must be in place before the record can be saved. In that case, your
only option is to know what records have been saved from the subform and the
main form and execute a delete query for each.

Subforms are best used to display zero or more records in a table related to
the record in the main form, and, in the business and personal database
applications I've developed, it is not catastrophic to have a main (parent)
record without child records in the related table. If you are using
form/subform in some different way, perhaps you should look at what you
have, what you are really trying to accomplish, and describe that for us.
Maybe someone will have a useful suggestion.

Larry Linson
Microsoft Office Access MVP

VRakesh via AccessMonster.com said:
BruceM said:
The main form record is saved when you enter the subform. If there is a
required field in the main form's Record Source you need a value for that
field before you save the record. I don't know where After Update fits
into
the picture, but if you are referring to the form's After Update event
that
also is too late to generate a number in a required field, as the record
needs to be saved before After Update will run. Further, if you are using
an
autonumber field you cannot control when a value is placed in that field.

Why do you want to wait until the user is in the subform?
You have the advantage of seeing your database. For those who cannont,
I
think more description will be needed of the database's purpose and
structure
[quoted text clipped - 17 lines]
after pressing the button)
Pls help me..

Hello Bruce,
That is exact the autonumbers are in-fact generated as i use the After
Update
event which i have to use in the main form, but you see the problem is my
user is quite a person. At time he may simply close the form without
putting
any data in the subform which will result in scrap in my table in addition
to
lose of an autonumber...So what i wish is that the user when is very sure
that he has entered the right data should click the button and the table
should be updated....
You see the user may simply close the form before updating the
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top