info from a list adding to a blank table

  • Thread starter HowardChr via AccessMonster.com
  • Start date
H

HowardChr via AccessMonster.com

I have a form with a list on it. The list is being populated by a table. I
would like it so that when I click a command button, whichever option was
selected on the list get copied (or moved) to a new table titled "Input". I
thought about using an append query, but don't know enough about them to
understand what I'm doing. Is there an easy way to do this? Right now I
have the following code put into my command button:

"Private Sub Command15_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = Me.List12
CurrentDb.Execute "Uno", dbFailOnError


DoCmd.Close acForm, ("Loc-1L")
DoCmd.OpenForm ("Loc-2s")

End Sub"

When clicked, SOMETHING seems to function as there is a split second of delay,
however there are not error messages. When I check my table, it is not
updated. Bummer... any ideas? I'm still new at this so.. try to keep it
simple. Thanks!
 
C

Carl Rapson

HowardChr via AccessMonster.com said:
I have a form with a list on it. The list is being populated by a table.
I
would like it so that when I click a command button, whichever option was
selected on the list get copied (or moved) to a new table titled "Input".
I
thought about using an append query, but don't know enough about them to
understand what I'm doing. Is there an easy way to do this? Right now I
have the following code put into my command button:

"Private Sub Command15_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = Me.List12
CurrentDb.Execute "Uno", dbFailOnError


DoCmd.Close acForm, ("Loc-1L")
DoCmd.OpenForm ("Loc-2s")

End Sub"

When clicked, SOMETHING seems to function as there is a split second of
delay,
however there are not error messages. When I check my table, it is not
updated. Bummer... any ideas? I'm still new at this so.. try to keep it
simple. Thanks!

You're going to have to execute an INSERT statement to do what you want. You
code should look something like this:

CurrentDb.Execute "INSERT INTO [Input] ([field]) VALUES (""" & Me.List12 &
""")", dbFailOnError

This assumes that the value in List12 (and the field in the Input table) is
a text value. If it's a number, the syntax would be:

CurrentDb.Execute "INSERT INTO [Input] ([field]) VALUES (" & Me.List12 &
")", dbFailOnError

Note that I don't know the name of the field in the table, so I just made up
a name. I have no idea what "Uno" means.

Carl Rapson
 
H

HowardChr via AccessMonster.com

YES!!! Thank you SOOOOO much... I've been working this problem for over a
week now, and no-one has been able to help me. THANK YOU!

Carl said:
I have a form with a list on it. The list is being populated by a table.
I
[quoted text clipped - 23 lines]
updated. Bummer... any ideas? I'm still new at this so.. try to keep it
simple. Thanks!

You're going to have to execute an INSERT statement to do what you want. You
code should look something like this:

CurrentDb.Execute "INSERT INTO [Input] ([field]) VALUES (""" & Me.List12 &
""")", dbFailOnError

This assumes that the value in List12 (and the field in the Input table) is
a text value. If it's a number, the syntax would be:

CurrentDb.Execute "INSERT INTO [Input] ([field]) VALUES (" & Me.List12 &
")", dbFailOnError

Note that I don't know the name of the field in the table, so I just made up
a name. I have no idea what "Uno" means.

Carl Rapson
 
Top