Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This site is a great forum to exchange knowledge..."

Geography

Where in the world do Tek-Tips members come from?
BigChinoDon (MIS)
22 May 12 13:35
Hello,

I'm trying to open forms based on child records of the parent.

- If no child records exist, open form to add new record
- If only one child record exists, then open form to edit that record.
- If more than one child record exits, open a form to select which record you wish to edit, then open the form to edit that record.

The event to make the choice would be a double-click on the detail portion of the form.

Any thought on best way to achieve this?

Thanks,
Don
Helpful Member!  PaulF (TechnicalUser)
29 May 12 7:57
One method is to use DCount() to check the table for a count of the records with the Primary Key value. If DCount returns zero, open the form to add a new record, if DCount returns 1, open a form with the filter set to the Primary Key, if more than one you can either populate a combobox/listbox with data from each of the records to allow selecting from or use a subform (Continuous) to let them select the record to edit. Once the selection is made, open the edit form using the Primary Key and any other Key fields as the filters for the new form.

PaulF

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close