Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Initialize

Status
Not open for further replies.

stlrain95

Programmer
Sep 21, 2001
224
US
If I create a form in VB...then there is an option for Initialize. But if I create a form in Access, I don't get the same luxury. I want a message box to pop up before the main window loads. This will insert the data into the main window.

Private Sub UserForm_Initialize()
Dim person As String
txtPerson.Text = InputBox("Enter QC Operator Name:")
End Sub


I am currently doing this in Excel...but am having a hard time translating to Access.

Thank you,
 
You can do that in the form's ON LOAD property.

Jim DeGeorge [wavey]
 
Is this what you need

Private Sub UserForm_Load()
Dim person As String
txtPerson = InputBox("Enter QC Operator Name:")
End Sub




Note: The .Text at the end is an unnecessary taurtology as .Text is the default property of a Text Box Control anyway.







G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
For some reason, I was getting an error for Focus...but when I take the .txt out...it works great.

Thank you,
 
To quote the MSAccess's own Help File

Note To set or return a control's Text property, the control must have the focus, or an error occurs.

If you don't specify .Text then it is the .Text property that gets set but the control does not need the focus.


'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Thank you for the lesson....I will take it forward in my future learnings!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top