Glaswegian
05-15-2008, 06:05 AM
Hi all
I'm not sure if I'm going about this the right way, but at the moment I'm stuck.
I have a workbook with various forms. The forms are accessed by choosing a specific command button on the one visible sheet. Data is input to the form, and once complete users click a button on the form. This then opens another form that allows users various save/cancel options via a series of option buttons The original input form remains visible until the save/cancel operation is complete. All forms are modal.
To avoid data going to the wrong sheet, I'd like to be able to find out which form has been used for input. I can then check this against the option button selected.
At the moment, I write the original form name to a hidden sheet - I know the name because each button opens a specific form.
What I can't work out is how to use this name with the save/cancel form. For example
If opt1 = True Then
DataToHolding
Me.Hide
frmMain.Hide
End If
If opt2 = True Then
DataToData
Me.Hide
VBA.UserForms.Item(cForm).Hide
'.....................and so on......
Data is written to the relevant sheet, the save/cancel form is then hidden and I would then like to check the original form used, but the "VBA.UserForms" part is the nearest I can get. - and of course I receive a 'type mismatch' error.
I would appreciate any suggestions
I'm not sure if I'm going about this the right way, but at the moment I'm stuck.
I have a workbook with various forms. The forms are accessed by choosing a specific command button on the one visible sheet. Data is input to the form, and once complete users click a button on the form. This then opens another form that allows users various save/cancel options via a series of option buttons The original input form remains visible until the save/cancel operation is complete. All forms are modal.
To avoid data going to the wrong sheet, I'd like to be able to find out which form has been used for input. I can then check this against the option button selected.
At the moment, I write the original form name to a hidden sheet - I know the name because each button opens a specific form.
What I can't work out is how to use this name with the save/cancel form. For example
If opt1 = True Then
DataToHolding
Me.Hide
frmMain.Hide
End If
If opt2 = True Then
DataToData
Me.Hide
VBA.UserForms.Item(cForm).Hide
'.....................and so on......
Data is written to the relevant sheet, the save/cancel form is then hidden and I would then like to check the original form used, but the "VBA.UserForms" part is the nearest I can get. - and of course I receive a 'type mismatch' error.
I would appreciate any suggestions