Setting values

D

Dmac

Here is what I have. I have a form with a couple of command buttons called
cmdAB and cmdCD respectively. When you click the cmdAB command button it
opens the frmABSwitchboard, and the cmdCD opens the frmCDSwitchboard.

Both switchboards has 4 unbound text boxes with the visible property set to
no. Each text box is given a value when the form opens depending on the
value from the txtUnit text box from the frmUnitInfo form.

Dim iUnit As Integer

''' value from text box on frmUnitInfo- hidden mode
iUnit = Forms!frmUnitInfo!txtUnit

If iUnit = 1 Then
Me.BFrom.Value = "100" ' Range of cells on B Wing
Me.BTo.Value = "131"
Me.AFrom.Value = "200" ' Range of cells on A Wing
Me.ATo.Value = "231"
ElseIf iUnit = 2 Then
Me.BFrom.Value = "100"
Me.BTo.Value = "125"
Me.AFrom.Value = "200"
Me.ATo.Value = "225"
End If

frmCDSwitchboard is the same as AB except the range of cells are different.

What I would like to do is cut out the two different switchboards. Have
only one switchboard an fill the unbound text boxes with the values of the
respective wings depending on which command button was clicked.

I am doubling my work on everything I am creating. If I create a report for
one switchboard, I have to create a second report for the other switchboard
because the reports reference the values from the text boxes.

I sure would appreciate any assistance. Treat me with kid gloves, I am a
self taught newbie :).

Thanks in advance.
 
D

Dmac

Thank you very much for your response. I have always read about the
OpenArgs but I never really understood how it all worked. And it works
beautifully. I am sure I am not any different from the rest. The more I
learn the more I realize that I could have probably done this differently
and been a lot more efficent. Every project I get involved in the more I
learn and the more I want to learn, not to mention the more I learn the more
doors get opened and I (start) to think outside the box.

Thanks again.
 
Top