Using and object to pass values between forms

mikeco555

Registered User.
Local time
Today, 14:10
Joined
Jan 23, 2004
Messages
22
I need some help with this problem as I've tried to resolve it for hours.

First let me startout by saying I am using access 2000.
What I am trying to do is to pass a string value from a combo box on a form to a Text box on a sub-form of that form. I have tried to create a class(consisting of let and get properties) and in-turn create an instance of that class on the sub-form to access its data. Here is where my frustration starts..... Everything seems like its going to work until I create an instance of the class on the sub-form, when I do this the intellesence does not recognize the object and I cannot create it. I noticed within my class the only 2 options I have for the Insaniating property of the class is 1-private, and 2-publicNotCreateable both are useless to me. I have done previous coding in Visual Basic(not for access) and the Insaniating property I use is 5-Multi-use.
How come this option is not available, Is it the version of VBA that I am using.
If anyone has any Ideas about where I should go from here it would be greatly appriciated. :D

Thanks,
Mike Oakes
 
Could you just set the value of one control to value of the other control in an event routine?
 
No, I tried that and it gave me an error stating that an object is required.
 
You should be able to. Getting the value of combo is tricky, you must have you syntax error.
 
Nice exercise…

Given that I don’t really understand the question here are a few answers… ;)

A97 demo attached.

Regards,
Chris.
 

Attachments

Last edited:
Mike,

Withstanding Chris's example, if I understand what you're trying to do, you don't need nor would you use a class to accomplish this. It would be like creating a toolbox and then adding a hammer to that toolbox to change the channel on your television. If you're thinking "That doesn't make sense," then you've caught my meaning.

One simple line of code can do it. You would probably want to put that line of code into the combo's AfterUpdate event. There's good info in the Help file on events -- worthy of a long read and re-read if this is Greek to you...

Code:
'Take this as pseudo code -- syntax may be off
'Assuming you are using a nested subform.
	Forms!MainFormName.SubFormName.TextBoxName = _
	Forms!MainFormName.ComboBoxName

Code:
'Take this as pseudo code -- syntax may be off
'Assuming you have two unlinked forms.
	Forms!MainFormName.TextBoxName = _
	Forms!SecondFormName.ComboBoxName

Regards,
Tim
 

Users who are viewing this thread

Back
Top Bottom