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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

autofilling option from a cmd button

Status
Not open for further replies.

thefroggy

Technical User
Apr 20, 2004
31
GB
Hi everyone.

I'm a newby in VBA and I have been trying to do something for sometime without any success.

I have 5 command buttons on my “main” form. All on them open the same “page” form only the subforms change depending on the command button clicked.

On the “page” form the users manually enter a code depending on the command button clicked (e.g cmd 1 = “ABC”, cmd 2 = “DEF”…). I would like to eliminate this manual step with an auto filling system. If the users click cmd1, “ABC” should appear automatically in the textbox situated in “page form”.

I'm trying to use the function Me.textbox1.value = "ABC" from a command button. It works fine in On Load option of the “page form”, but it is not what I want.

That’s what I’m trying to do, but it is not working, I guess that Access is looking at Textbox1 in the “main” form not “page “ form

DoCmd.OpenForm "page"
DoCmd.GoToRecord , "page", acNewRec
Me.Textbox1.value = "ABC" (inside "page" form)

Hope this is clear enough and that you can help me.

Thanks

Froggy.
 
Replace this:
Me.Textbox1.value = "ABC"
By this:
Forms![page]!Textbox1.Value = "ABC"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks it works like a charm. I'll use this function for many other application thanks again

froggy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top