Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello, I'm looking for a way to

Status
Not open for further replies.

idono

Technical User
Jan 16, 2002
71
US
Hello,

I'm looking for a way to use the Forms!frmCISP.txtEnd.value callout in an automated way. For instance I have a form call another form and set a module level variable with the current control name.

Forms!frmCISP.ctlToSet.Value

This works but I would also like to use a variable in the place of the form name.

Forms!FormName.ctlToSet.Value

This produces an error "Can't find the form FormName".

I have tried to dimension the variable as a control, form, and userforms, and I still get the error.

Does anyone have any experience with this area?

Dugger
 
Hi,
I don't know what version you're using, but I've got Access '97 over here and declaring it as a form will work, but you just need to leave the "Forms!" off the front. Since you've already declared the variable as a form, you don't need to tell it to look in a collection...

So use: FormName!ctlToSet.Value

Hope this helps Kyle ::)
 
I'm not sure exactly what you're attempting here, but I think you may need to have the 'receiving' form active before you start messing about assigning values to controls on it. Try opening the form before you assign values to controls on it.





Jim Hare
"Remember, you're unique - just like everonone else"
 
Hi Dugger!

Make FormName a string and use it like this:

Forms(FormName).ctlToSet.Value

hth
Jeff Bridgham
bridgham@purdue.edu
 
You people are the best. I used the Forms(FormName).cltToSet.Value approach and after days of confusion and frustration I am at peace. At least until I try some other trick.

Thank You,
Dugger
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top