Identify calling form for use by a common calander form

P

Phil Everist

I have a calander form that operates as a popup. Clicking a
date populates that date into the date field on the form
with the calendar control.
I want to be able to use the same calendar popup from
multiple forms. How can I identify which form triggered the
calendar control so I can update the appropriatre date
field?
 
W

Wayne Morgan

Pass the name of the calling form in the OpenArgs parameter of the
DoCmd.OpenForm call.
 
P

PC Datasheet

Add this code to your code that populates that date into the date field on the
form with the calendar control:
Me.Visible = False

Replace the code you now have to open the calendar form with this code:

DoCmd.OpenForm "NameOfCalendarForm",,,,,acDialog
Me!NameOfDateFieldOnCallingForm = Forms!NameOfCalendarForm!
NameOfDateTextBoxOnCalendarForm
Docmd.Close acForm, "NameOfCalendarForm"

Note: Watch word wrap in lines 2 and 3
 

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