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!

update all table records to value in a combo box

Status
Not open for further replies.

ali32uk

Technical User
Mar 31, 2011
22
GB
Hi All

Last question for today...

I want to use an update query to update every value in a table column "recordvalue" to the value entered in my form TxtRecordvalue, I know I should know this but for the life of me I cant figure it

Any help appreciated!

Alastair
 
[tt]
strSQL = "UPDATE TableName " & _
" SET recordvalue = '" & TxtRecordvalue & "'"[/tt]

If recordvalue is a Number, skip the single quotes.

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
HI thanks for your response

I ve tried this but unfortunately it just places " & TxtRecordvalue & " in the table field... am I doing something wrong?

SQL
UPDATE ExportTable SET ExportTable.recordvalue = '" & txtrecordvalue & "';

BR

Alastair
 
I think Andy was suggesting you create your string and then run the string

Code:
dim strSql as string
strSQL = "UPDATE TableName " & " SET recordvalue = '" & TxtRecordvalue & "'"
currentdb.execute strSql

you look like you just built a query and then tried to run it. If that is the case you have to fully qualify the control
Code:
UPDATE ExportTable SET ExportTable.recordvalue = '" & [Forms}![YourFormName]![txtrecordvalue] & "'
 
MajP is right, I assumed you have the code in the UserForm where you have the control (combo box...?) named TxtRecordvalue (prefix txt suggests a text box...) and that’s where you wanted to execute the Update statement.

If that is NOT the situation, you have to be more specific of what you have.

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top