ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem using UserForm in Macro (https://www.excelbanter.com/excel-programming/273901-re-problem-using-userform-macro.html)

terence

Problem using UserForm in Macro
 
Hi Bob,

umm... it still doesn't work....

Terence
-----Original Message-----
Terence,

The form is being loaded before you populate the textbox.

Trying doing it
the other way around

Private Sub cmdButton_Click()
:
:
frmTest.txtbox1.Value = rst.Fields("testing")
frmTest.Show
End Sub


--

HTH

Bob Phillips

"Terence" wrote in message
...
Hi,

I am writing a macro with a button on the worksheet.

When
the button is clicked, the userform pops up and the data
of the recordset is displayed on the textbox of the

form.

e.g.

Private Sub cmdButton_Click()
:
:
frmTest.Show
frmTest.txtbox1.Value = rst.Fields("testing")
End Sub


However, the screen pops up but the textbox remains

empty.
Then I close the form and press the button again, the
screen pops up but this time the value is shown on the
textbox. Does anyone knows why?
Thanks a lot.

Terence



.


Bob Phillips[_5_]

Problem using UserForm in Macro
 


--

HTH

Bob Phillips

"Terence" wrote in message
...
Hi Bob,

umm... it still doesn't work....

Terence
-----Original Message-----
Terence,

The form is being loaded before you populate the textbox.

Trying doing it
the other way around

Private Sub cmdButton_Click()
:
:
frmTest.txtbox1.Value = rst.Fields("testing")
frmTest.Show
End Sub


--

HTH

Bob Phillips

"Terence" wrote in message
...
Hi,

I am writing a macro with a button on the worksheet.

When
the button is clicked, the userform pops up and the data
of the recordset is displayed on the textbox of the

form.

e.g.

Private Sub cmdButton_Click()
:
:
frmTest.Show
frmTest.txtbox1.Value = rst.Fields("testing")
End Sub


However, the screen pops up but the textbox remains

empty.
Then I close the form and press the button again, the
screen pops up but this time the value is shown on the
textbox. Does anyone knows why?
Thanks a lot.

Terence



.




Bob Phillips[_5_]

Problem using UserForm in Macro
 
Terence,

Without seeing the rest of the code, I can't think of anything else.

--

HTH

Bob Phillips

"Terence" wrote in message
...
Hi Bob,

umm... it still doesn't work....

Terence
-----Original Message-----
Terence,

The form is being loaded before you populate the textbox.

Trying doing it
the other way around

Private Sub cmdButton_Click()
:
:
frmTest.txtbox1.Value = rst.Fields("testing")
frmTest.Show
End Sub


--

HTH

Bob Phillips

"Terence" wrote in message
...
Hi,

I am writing a macro with a button on the worksheet.

When
the button is clicked, the userform pops up and the data
of the recordset is displayed on the textbox of the

form.

e.g.

Private Sub cmdButton_Click()
:
:
frmTest.Show
frmTest.txtbox1.Value = rst.Fields("testing")
End Sub


However, the screen pops up but the textbox remains

empty.
Then I close the form and press the button again, the
screen pops up but this time the value is shown on the
textbox. Does anyone knows why?
Thanks a lot.

Terence



.





All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com