replacimg Me. referring to a combo

sambrierley

Registered User.
Local time
Yesterday, 17:57
Joined
Apr 24, 2014
Messages
56
Hi all,

Ive written some code in a forms module that is repeated alot. i want to move this code to a module and call it so i have to replace the Me. with a full reference but i cant get it right, when i replace with what i think it should be it keeps saying object doesnt support this method.

Forms![Manager_Form].Approval_tbctrl.Week_Cmb
Manager_FOrm is the main Form
Approval_tbctrl is the name of the tabctrl page (Mngr_tbctrl is the name of the tabctrl)
and week_Cmb is the combo b0ox.

thanks for any help
 
What's the code you are trying to run?
 
I just want to assign the value in the combobox to a variable.
 
I'll rephrase - Could you show us what code you are currently using that isn't working. You've given us the error but not the source of it.
 
no problem.

Code:
Dim WeekEnd As Integer
WeekEnd = Me.Week_Cmb
 
Okay what value is bound to Week_Cmb?, what is it's record source.
And I assume that this works on the form event but not in the function?

If so can you post up the function code
 
The source is the result of a SQL query that lands in a combo box. yes that correct its fine in the form but not a module. unfortunatly i dont have much to show as everything ive tried doesnt work. i think it should be something like below but it doesnt work.
dim Weekend as integer
WeekEnd = Forms!Manager_Form.Approval_tbctrl.Week_Cmb
 
You don't need to refer to the tab control - try
Code:
Forms![Manager_Form]![Week_Cmb]
Tab controls don't "hold" other control objects as such, they are just layers on the main form, if that makes sense?
 

Users who are viewing this thread

Back
Top Bottom