View Single Post
  #2  
Old August 1st, 2004, 07:47 AM
John Nurick
external usenet poster
 
Posts: n/a
Default What is wrong with this SQL string?

Hi Kenny,

Try
Me.Place.Value
instead of Place.Value. But IMHO it's usually a good idea to make sure
that controls on forms don't have the same names as the fields they are
bound to. So I'd call the textbox
txtPlace
instead, hence
Me.txtPlace.Value

This assumes that the code is in the same form as the control. For a
control on a different form you can use
Forms("frmName").Controls("txtPlace").Value
or
Forms!frmName!txtPlace



On Sun, 1 Aug 2004 08:13:41 +0200, Kenny wrote:

Hi guys,

I have a SQL string here that is intended to add the contents of a textbox
into an unrelated table at the click of a button(the table is the rowsource
for the textbox).

DoCmd.RunSQL "INSERT INTO tblLetdownplaces([Place]) VALUES( " & Place.Value
& ");"

When I run this, it brings up a little dialog box asking me for the value of
whatever text I have entered into the textbox.......eg. if I type in ABCD,
it will ask for a value for ABCD. If I enter a value into the text box, it
accepts it and places in the table.

What am I doing wrong?

Thanks guys.

Kenny


--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.