Simple syntax question (1 Viewer)

jfi

Registered User.
Local time
Today, 16:57
Joined
Jan 28, 2000
Messages
22
How do I pass a control location around in a variable?

Specifically, I have a form with the calendar control. I want to be able to double click on a control on another form and have that form tell the calendar where to stick its value once the user is happy with it.

I made a public variable to hold the target:

Public strDateDestination as String

So the idea is to copy the control in the form of a string to this variable when I double click it, then open the Calendar form

strDateDestination = "frmUser!Date"
doCmd.OpenForm "frmCalendar", acNormal

THEN, after choosing the date, you hit the OK button and the calendar form writes the value of the calendar control to whatever location you stuck in the variable. I don't know how to do that. I thought it would be

Forms(strDateDestination) = Me!Calendar.Value

but that didn't work.

-Joshua
 

jfi

Registered User.
Local time
Today, 16:57
Joined
Jan 28, 2000
Messages
22
Boy, do I feel dumb. I was so worried about trying to find how to use a string as a control name that I missed the whole control variable business. oops.

public datedestination as Control

and

set datedestination = blah blah blah

works like a charm
 

Users who are viewing this thread

Top Bottom