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

auto fill textbox in form from Cmdbutton

Status
Not open for further replies.

thefroggy

Technical User
Joined
Apr 20, 2004
Messages
31
Location
GB
Hi,

Thanks in advance for the help.

I'am a newby and I'm using access 2000. Here what I'm trying to do.

The users will start with a form with 5 cmdbuttons options, which open the same form. I'm trying to write a code which allow me to autofill un textbox depending on the cmdbuttom chosen. Here is the (faulty) code I'm trying.

DoCmd.OpenForm "form"
DoCmd.GoToRecord , "form", acNewRec
Me![textboxname] = BLA

Hope this is clear enough,

Thanks,

Phane
 
try
DoCmd.OpenForm stDocName, , , acNew
Me![textboxname] = BLA


Hope this helps
Hymn
 
Sorry
DoCmd.OpenForm YourFormName, , , acNew


Hope this helps
Hymn
 
Hi Hymn,

thank for the reply, but it is not working. I think that the prb come from

Me![textboxname] = BLA

This is not the good expression to automiticaly add value to a textbox, I think. I actually want to add the letters "BLA" in the textbox as new entry.

Do you understand what I mean?

phane
 
Something like this ?
Me![textboxname] = "BLA"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi PH,

Thanks for tying...but nope. I have got the following message: "Microsoft access can't find the field "textboxname" referrer to in your expression"

I double check and the name give to me textbox is correctly spell. Do not get it, should be easy stuff to do. Do you think that the expression:

Me![textboxname] = "BLA" is to create a new entry or to look for an existing one?

Thanks again for trying.

Phane
 
Me![textboxname] = "BLA" is to create a new entry or to look for an existing one?
It is to set the Value property of a control named textboxname in the current form to 'BLA'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
try
textboxname = "BLA"

Hope this helps
Hymn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top