tags:

views:

37

answers:

1

can someone please help me with the following query

i need to update a datasheet (table) in access through a form:

i will have something like this

SQLtext = "update table1 set column1="sometext" where column2=textbox1.value"
DoCmd.RunSQL SQLtext

is this possible to do?

i have a textbox on a form and when i click a button on that form i want to update data in the datasheet where one of the columns is equal to the value property of a textbox

thank you!

+2  A: 

This is what you need (note the subtle change)

SQLtext = "update table1 set column1='sometext' where column2='" & textbox1.value & "'"
DoCmd.RunSQL SQLtext

Note: For production code you will want to escape out any single quotes in the textbox1.value string using the string replace function, otherwise you will get a SQL error whenever a user types a single quote in that field.

JohnFx