0

Hi there,

I am having trouble with public variables.

I am trying to create a public variable when a button is pressed. and then recall it on a different form. I cant seem to get it working.

The code on form 1 is:

Private Sub cmdstu_Click()

fmpay1.Text1 = "Students"
fmpay1.Text2 = "0.80"
strtype = "students"
fmdest1.Show
fmticket.Hide

End Sub

on the module: Public strtype As String

on the second form:

Private Sub Form_Load()

    txttot.Text = strtype

End Sub

Ideally what I am trying to do is capture what was pressed and then add it into a shopping basket type environment of the second form. I can get the detail to show using the

fmpay1.Text1 = "Students" line but then when I try to make it back into a sting it doesnt work strtype = Text1.Text

any ideas ?

Edited by diafol: fixed formatting

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by pip1975
0

Its hard for me to follow which forms are which in your example. However, you can use
Use fmticket.Text1.Text = fmpay1.Text1.Text to have one form's text box use the value of the other.

0

Its hard for me to follow which forms are which in your example. However, you can use
Use fmticket.Text1.Text = fmpay1.Text1.Text to have one form's text box use the value of the other.

hello,
i got that bit working, where i have the problem is when i want to make the fmpay1,text into a string


i cant use the public var. to take it from the first form fmticket

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.