PDA

View Full Version : Solved: UserForm, Passing Variable (Excel '97)



phendrena
08-03-2009, 08:01 AM
Hi,

I have two userforms setup.
The first UserForm has three TextBoxes.

When the user clicks an icon next to the TextBox a second form is shown to allow the user to correctly enter a start time and end time.

The user then chooses a start and end time from the two ComboBoxes. When the user clicks close the values from the ComboBoxes are converted into a single string and then placed into the correct TextBox.

In theory, that is what is supposed to happen.
In practice i'm having problems making it work.

Code from the Originating Form :-
Sub imgShift1_Click()
Refer = 1
frmShifts.Show (Refer)
End Sub

Code from the SubForm :-
Dim R As Variant

Sub UserForm_Initialize(Refer)
Set R = Refer
End Sub

I am getting the following error :
Compile Error
Event procedure declaration does not match description of event having the same name

I am a little confused as i have little experience with passing variables. Would anyone please be able to help.

Many thanks,

Bob Phillips
08-03-2009, 08:23 AM
Originating form



Sub imgShift1_Click()
frmShifts.Refer = 1
frmShifts.Show
End Sub


Sub Form



Private R As Variant

Public Property Let Refer(Val As Variant)
R = Val
End Property

phendrena
08-04-2009, 08:47 AM
as usual xld your able to provide the solution.
i wouldn't have got this answer myself to quickly.

many thanks.