initialize form

R

richaluft

I'm using an order/entry type of form/subform, and I'm having a
problem designing a 'Next Entry"
button. I'd want to clear all data fields from the Form/Subform, add
a new 'DataNumber' (from a CustomCounter function), and the select a
new client (different from the previous one).
The form/subform has a filter = [Client ID#] = Forms![Form1]![Select
Client], and the form and subform are linked by 'Client ID#'.
The subform has recordsource = SELECT Services.* FROM SERVICES WHERE
(((Services.[Client ID#])=0)); so that subform doesnt open with old
valeus for client.
I've tried setting all fields = Null, and requerying the subform (as
well as requerying the entire form), but I keep getting a problem that
the subform field [Client ID#] is not updating to the new value, and
the form doesn't function properly.
Can anyone explain how to best initialize this form in an efficient
manner, so that it functions properly.
Thanks for your help.
RL
 
T

tina

well, your mainform/subform setup is something of a mystery, as well as the
relationship between the underlying tables. but i'll take a stab at it: if
tblClients (?) is the one- side of a one-to-many relationship with
tblServices (?), and ClientID is the primary key of tblClients and a foreign
key in tblServices, then i'm guessing that the mainform's RecordSource is
tblClients. in that case, the subform's RecordSource should be set to
tblServices (no reason for a query with criteria). in mainform Design view,
click ONCE on the subform to select it, then look at the Properties box and
make sure that the LinkChildFields setting is ClientID (referring to the
foreign key field in tblServices), and the LinkMasterFields setting is
ClientID (referring to the primary key field in tblClients). if you don't
want to see any existing records in the subform, when you're looking at an
existing client record in the mainform, then set the subform's DataEntry
property to Yes - though that seems a weird requirement to me; how can you
avoid entering duplicate service records for a client if you can't see
what's already there? well, at any rate...if the above scenario fits your
situation, or if you can use the scenario as a "template" to apply to your
situation, then give it a try and see if it meets your needs.

hth
 
R

richaluft

well, your mainform/subform setup is something of a mystery, as well as the
relationship between the underlying tables. but i'll take a stab at it:  if
tblClients (?) is the one- side of a one-to-many relationship with
tblServices (?), and ClientID is the primary key of tblClients and a foreign
key in tblServices, then i'm guessing that the mainform's RecordSource is
tblClients. in that case, the subform's RecordSource should be set to
tblServices (no reason for a query with criteria). in mainform Design view,
click ONCE on the subform to select it, then look at the Properties box and
make sure that the LinkChildFields setting is ClientID (referring to the
foreign key field in tblServices), and the LinkMasterFields setting is
ClientID (referring to the primary key field in tblClients). if you don't
want to see any existing records in the subform, when you're looking at an
existing client record in the mainform, then set the subform's DataEntry
property to Yes - though that seems a weird requirement to me; how can you
avoid entering duplicate service records for a client if you can't see
what's already there? well, at any rate...if the above scenario fits your
situation, or if you can use the scenario as a "template" to apply to your
situation, then give it a try and see if it meets your needs.

hth




I'm using an order/entry type of form/subform, and I'm having a
problem designing a 'Next Entry"
button.  I'd want to clear all data fields from the Form/Subform, add
a new 'DataNumber' (from a CustomCounter function), and the select a
new client (different from the previous one).
The form/subform has a filter = [Client ID#] = Forms![Form1]![Select
Client], and the form and subform are linked by 'Client ID#'.
The subform has recordsource = SELECT Services.* FROM SERVICES WHERE
(((Services.[Client ID#])=0));  so that subform doesnt open with old
valeus for client.
I've tried setting all fields = Null, and requerying the subform (as
well as requerying the entire form), but I keep getting a problem that
the subform field [Client ID#] is not updating to the new value, and
the form doesn't function properly.
Can anyone explain how to best initialize this form in an efficient
manner, so that it functions properly.
Thanks for your help.
RL- Hide quoted text -

- Show quoted text -
Yes, that is the basic form/subform setup: but the question is how to
initialize this form without having to close the form and then re-open
it?
 
T

tina

well, i have no idea what you mean by "initialize the form", sorry. i
thought your problem was that you couldn't add records to the subform; and
my analysis was that your subform is not set up properly, and possibly not
linked properly with the mainform. i suggested a setup that should allow you
to enter data in the subform. did you try it?

hth


well, your mainform/subform setup is something of a mystery, as well as the
relationship between the underlying tables. but i'll take a stab at it: if
tblClients (?) is the one- side of a one-to-many relationship with
tblServices (?), and ClientID is the primary key of tblClients and a foreign
key in tblServices, then i'm guessing that the mainform's RecordSource is
tblClients. in that case, the subform's RecordSource should be set to
tblServices (no reason for a query with criteria). in mainform Design view,
click ONCE on the subform to select it, then look at the Properties box and
make sure that the LinkChildFields setting is ClientID (referring to the
foreign key field in tblServices), and the LinkMasterFields setting is
ClientID (referring to the primary key field in tblClients). if you don't
want to see any existing records in the subform, when you're looking at an
existing client record in the mainform, then set the subform's DataEntry
property to Yes - though that seems a weird requirement to me; how can you
avoid entering duplicate service records for a client if you can't see
what's already there? well, at any rate...if the above scenario fits your
situation, or if you can use the scenario as a "template" to apply to your
situation, then give it a try and see if it meets your needs.

hth




I'm using an order/entry type of form/subform, and I'm having a
problem designing a 'Next Entry"
button. I'd want to clear all data fields from the Form/Subform, add
a new 'DataNumber' (from a CustomCounter function), and the select a
new client (different from the previous one).
The form/subform has a filter = [Client ID#] = Forms![Form1]![Select
Client], and the form and subform are linked by 'Client ID#'.
The subform has recordsource = SELECT Services.* FROM SERVICES WHERE
(((Services.[Client ID#])=0)); so that subform doesnt open with old
valeus for client.
I've tried setting all fields = Null, and requerying the subform (as
well as requerying the entire form), but I keep getting a problem that
the subform field [Client ID#] is not updating to the new value, and
the form doesn't function properly.
Can anyone explain how to best initialize this form in an efficient
manner, so that it functions properly.
Thanks for your help.
RL- Hide quoted text -

- Show quoted text -
Yes, that is the basic form/subform setup: but the question is how to
initialize this form without having to close the form and then re-open
it?
 
R

richaluft

well, i have no idea what you mean by "initialize the form", sorry. i
thought your problem was that you couldn't add records to the subform; and
my analysis was that your subform is not set up properly, and possibly not
linked properly with the mainform. i suggested a setup that should allow you
to enter data in the subform. did you try it?

hth


well, your mainform/subform setup is something of a mystery, as well as the
relationship between the underlying tables. but i'll take a stab at it:if
tblClients (?) is the one- side of a one-to-many relationship with
tblServices (?), and ClientID is the primary key of tblClients and a foreign
key in tblServices, then i'm guessing that the mainform's RecordSource is
tblClients. in that case, the subform's RecordSource should be set to
tblServices (no reason for a query with criteria). in mainform Design view,
click ONCE on the subform to select it, then look at the Properties box and
make sure that the LinkChildFields setting is ClientID (referring to the
foreign key field in tblServices), and the LinkMasterFields setting is
ClientID (referring to the primary key field in tblClients). if you don't
want to see any existing records in the subform, when you're looking atan
existing client record in the mainform, then set the subform's DataEntry
property to Yes - though that seems a weird requirement to me; how can you
avoid entering duplicate service records for a client if you can't see
what's already there? well, at any rate...if the above scenario fits your
situation, or if you can use the scenario as a "template" to apply to your
situation, then give it a try and see if it meets your needs.

news:2d256c26-c9c3-4e6b-90f4-2c7ba44c2e0f@x38g2000yqj.googlegroups.com....
I'm using an order/entry type of form/subform, and I'm having a
problem designing a 'Next Entry"
button. I'd want to clear all data fields from the Form/Subform, add
a new 'DataNumber' (from a CustomCounter function), and the select a
new client (different from the previous one).
The form/subform has a filter = [Client ID#] = Forms![Form1]![Select
Client], and the form and subform are linked by 'Client ID#'.
The subform has recordsource = SELECT Services.* FROM SERVICES WHERE
(((Services.[Client ID#])=0)); so that subform doesnt open with old
valeus for client.
I've tried setting all fields = Null, and requerying the subform (as
well as requerying the entire form), but I keep getting a problem that
the subform field [Client ID#] is not updating to the new value, and
the form doesn't function properly.
Can anyone explain how to best initialize this form in an efficient
manner, so that it functions properly.
Thanks for your help.
RL- Hide quoted text -
- Show quoted text -

Yes, that is the basic form/subform setup: but the question is how to
initialize this form without having to close the form and then re-open
it?- Hide quoted text -

- Show quoted text -

There is no problem entering data in the form/subform when the form
opens. It IS set up as you guessed.
The problem is that once the form has been filled out with data entry
for one client's order, I simply want a cmdbtn that will 'clear'
allthe data on the form/subform, so that a 'newrecord' can be entered
on the form. I could accomplish this by simply closing the form and
then re-open it (which works just fine), but I'd prefer the elegance
of a simple "new entry" button. Thus, what I mean by 'initialize' is
to clear all form/subform data and to prepare form for newdata entry,
as if the form had initially been opened.
RL
 
T

tina

if you're wanting to enter a new record in the mainform, there are several
ways to go to a new record. if a command button suits your fancy, then just
add a command button with the following code, as

DoCmd.RunCommand acCmdRecordsGoToNew

if you want to add a new record in the subform, you can do the same thing
with a command button on the subform, or you can probably just set the
subform's Cycle property to AllRecords, and make sure that the
AllowAdditions property is set to Yes.

the bottom line is, when you're using a bound form in Access, you don't have
to do anything complex to enter a new record - just go to a new record and
start typing. if you're not using a bound form, it's a different kettle of
fish - but you said that you are, so...

hth


well, i have no idea what you mean by "initialize the form", sorry. i
thought your problem was that you couldn't add records to the subform; and
my analysis was that your subform is not set up properly, and possibly not
linked properly with the mainform. i suggested a setup that should allow you
to enter data in the subform. did you try it?

hth


well, your mainform/subform setup is something of a mystery, as well as the
relationship between the underlying tables. but i'll take a stab at it: if
tblClients (?) is the one- side of a one-to-many relationship with
tblServices (?), and ClientID is the primary key of tblClients and a foreign
key in tblServices, then i'm guessing that the mainform's RecordSource is
tblClients. in that case, the subform's RecordSource should be set to
tblServices (no reason for a query with criteria). in mainform Design view,
click ONCE on the subform to select it, then look at the Properties box and
make sure that the LinkChildFields setting is ClientID (referring to the
foreign key field in tblServices), and the LinkMasterFields setting is
ClientID (referring to the primary key field in tblClients). if you don't
want to see any existing records in the subform, when you're looking at an
existing client record in the mainform, then set the subform's DataEntry
property to Yes - though that seems a weird requirement to me; how can you
avoid entering duplicate service records for a client if you can't see
what's already there? well, at any rate...if the above scenario fits your
situation, or if you can use the scenario as a "template" to apply to your
situation, then give it a try and see if it meets your needs.

news:2d256c26-c9c3-4e6b-90f4-2c7ba44c2e0f@x38g2000yqj.googlegroups.com...
I'm using an order/entry type of form/subform, and I'm having a
problem designing a 'Next Entry"
button. I'd want to clear all data fields from the Form/Subform, add
a new 'DataNumber' (from a CustomCounter function), and the select a
new client (different from the previous one).
The form/subform has a filter = [Client ID#] = Forms![Form1]![Select
Client], and the form and subform are linked by 'Client ID#'.
The subform has recordsource = SELECT Services.* FROM SERVICES WHERE
(((Services.[Client ID#])=0)); so that subform doesnt open with old
valeus for client.
I've tried setting all fields = Null, and requerying the subform (as
well as requerying the entire form), but I keep getting a problem that
the subform field [Client ID#] is not updating to the new value, and
the form doesn't function properly.
Can anyone explain how to best initialize this form in an efficient
manner, so that it functions properly.
Thanks for your help.
RL- Hide quoted text -
- Show quoted text -

Yes, that is the basic form/subform setup: but the question is how to
initialize this form without having to close the form and then re-open
it?- Hide quoted text -

- Show quoted text -

There is no problem entering data in the form/subform when the form
opens. It IS set up as you guessed.
The problem is that once the form has been filled out with data entry
for one client's order, I simply want a cmdbtn that will 'clear'
allthe data on the form/subform, so that a 'newrecord' can be entered
on the form. I could accomplish this by simply closing the form and
then re-open it (which works just fine), but I'd prefer the elegance
of a simple "new entry" button. Thus, what I mean by 'initialize' is
to clear all form/subform data and to prepare form for newdata entry,
as if the form had initially been opened.
RL
 

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