Solved

Access popup form - receive & return args

Posted on 2007-04-05
2
381 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

627 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