Solved

Access popup form - receive & return args

Posted on 2007-04-05
2
370 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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…
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…

914 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

20 Experts available now in Live!

Get 1:1 Help Now