Solved

Access popup form - receive & return args

Posted on 2007-04-05
2
374 Views
Last Modified: 2013-11-28
Hello,

I wanted to make a popup calendar selector form.
We have an active x calendar control we use but we normally have it on the form itself.

I wanted & did make a modal popup form to house the calendar control but wanted to pass in a date and return a date.  Doesn’t seem possible.  I think I pass in an argument via docmd.OpenForm but not sure how/if I can return a date from the form.

Id like others to be able to import & reuse this form in other projects as easily as possible, wanted to stay away from public vars if possible.

Any ideas how to best accomplish this?  

Using Access 2002
Thanks!
0
Comment
Question by:krazykoder
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 125 total points
ID: 18860071
There are several ways, if you don't mind using OpenArgs.

Add this to the code module of the form:

[General Declarations]
Private msFormName As String
Private msControlName As STring

Private Function SplitArgs(ValueIn As String) As Boolean
  Dim Arr() as String

  Arr = Split(ValueIn, ";")
  msFormName = arr(0)
  msControlName = Arr(1)

End Function

Sub Form_Open()
  SplitArgs Me.OpenArgs
End Sub

Now call your form like this:
DoCmd.OpenForm "N", , , , , ,  Me.Name & ";NameOfTheControlToUpdate"

Now, in your calendar form, add code like this in the Exit event, or in the Click event of a button click, or wherever you want to fire this:

Forms(msFormName).Controls(msControlName) = YourDateValue
0
 

Author Comment

by:krazykoder
ID: 18860416
Great - I think i like this, no public vars and all the code resides in the popup form.
Just what i was lookign for.
Thanks Bro!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question