Solved

Access popup form - receive & return args

Posted on 2007-04-05
2
369 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
Comment Utility
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
Comment Utility
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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now