Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access popup form - receive & return args

Posted on 2007-04-05
2
Medium Priority
?
385 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 500 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

Industry Leaders: 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

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…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

704 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