Limiting records to one per subform (part II)


S

Sergio

Hi there,

I added this post earlier today:
***
Hope someone can help me out...

I'm creating a contact management database. I have
multiple linked tables for each client. I've created a
form called "tbleAgency" to create, edit and view the
client information. I also have 5 subforms within
the "tblAgency" form. All records link fine, problem is
with the users.

Each subform should only have ONE associated record,
however, if a user is in one of the subforms (transparent
to them, they think it is all one form) and they use the
scroll button on their mouse or the next record command
in file menu, or tab key , or keyboard shortcut, etc, it
creates a new record. From the user's perspective, it
looks like all the fields are blanked out.
So, to summarize, I need to give users the ability to
create a new Client, but each subform should behave as if
it did not allow for adding new records. Problem is that
if I set the add records value to "no" the subform doesn't
appear with the parent form.

Hope I'm making sense.
****
Someone recommended that I prevent users from using the
scroll button on their mouse. That's a good idea,
however, I'm hoping to find a cleaner solution. Users
could still use a keyboard shortcut, or the tab key, etc.
Instead of blocking each of those, I'd like to find a
command that somehow limits how many records they can
create.

One idea I had was to set the attributes of the subforms
to not allow additions. But, when a new client is
created, I'd like to create a new record for each subform
programmatically, so that the subform will appear with the
parent but user couldn't create new record with it. Any
ideas on how I could do that?

Thanks so much!

-Sergio
 
Ad

Advertisements

T

TC

The Current event of the main form could check each subform to see whether
it does or does not have a record displayed. If it >does<, set the subform's
AllowAdditions property to False; then the user can not create new records
in that subform. But if it >does not< have a record already displayed, set
its AllowAdditions property to true, so it displays a blank new record slot.
Then, in each subform's AfterInsert event, set AllowAdditions back False
again, to stop the user creating a second new record.

HTH,
TC
 
Ad

Advertisements

S

Sergio

Perfect! THANK YOU!!!
-----Original Message-----
The Current event of the main form could check each subform to see whether
it does or does not have a record displayed. If it
does<, set the subform's
AllowAdditions property to False; then the user can not create new records
in that subform. But if it >does not< have a record already displayed, set
its AllowAdditions property to true, so it displays a blank new record slot.
Then, in each subform's AfterInsert event, set AllowAdditions back False
again, to stop the user creating a second new record.

HTH,
TC





.
 

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