-
I want to use a variable in a module to do the following:
cboComboBox.Clear
In a module, you have to specify which form on which this is supposed to happen. I want to have the form name be a variable so that I can use this code with several forms. On the form, I have the following code:
strFormName = Me.Name
The following code, which I am putting in my module is incorrect, but how do I fix this?
strFormName!cboComboBox.Clear
-
Declare a variable to hold the form itself, not the name of the form...
Code:
Dim frmForm As YourForm
Set frmForm = Me
.....
frmForm.cboComboBox.Clear
-
I can not use the type "YourForm". Why?
-
Try Dim frmForm As Form
-Mort
-
smh,
Sorry. "YourForm" was meant to be replaced by whatever you had defined your Form as... for example I have a form I use to edit patients called PatientEdit so for me it would look like...
Dim frmForm as PatientEdit
But Mortivan's suggestions should work as well.