thenone
asked on
sql update
How would I write a sql statement that will look for one field from one table and match it to the same filed in another field.If found it will update an integer number in the second table.The value of the integer will be represented by a text box in my form.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Aikimark: I think he wants to update the SECOND table.
Brian
Brian
ASKER
layout is like this
Table 1 Table2
field1 field1 id
update table2 "id" where table1 field1 matches table2 filed1 and use number from text field in vb.
Table 1 Table2
field1 field1 id
update table2 "id" where table1 field1 matches table2 filed1 and use number from text field in vb.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Brian,
That is not correct. You have a typo. It should be
dim strSQL as string
strSQL = "update [table2] inner join [table 1] on [table 1].[field1] = [table2].[field1] set [ID] = " & me.text1.text
That is not correct. You have a typo. It should be
dim strSQL as string
strSQL = "update [table2] inner join [table 1] on [table 1].[field1] = [table2].[field1] set [ID] = " & me.text1.text
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am using mysql 5.0
Please be aware that a field named "ID" is likely to be a primary key, which might prohibit you from changing its value.
ASKER
my id is just a regular integer so it would be
comm.execute "update table1 inner join table2 on table1.fieldname = table2.fieldname
set numfield = " & me.text1"
Thanks everybody for their help I will post points this afternoon.
comm.execute "update table1 inner join table2 on table1.fieldname = table2.fieldname
set numfield = " & me.text1"
Thanks everybody for their help I will post points this afternoon.
ASKER
one more question if I was just adding the field number then what?
What do you mean?
ASKER
ok so if I have a recordset where it is rs.open"select * from table1 where column=no"
then when I am looping through my records how can I have the recordset be able to change that column one at a time from no to yes.
then when I am looping through my records how can I have the recordset be able to change that column one at a time from no to yes.
What does that have to do with this SQL Update question?
ASKER
oops wrong question I posted my mistake what I mean to ask is how can I add the number to the existing number.
ASKER
This is the question I was supposed to post to.My bad.
https://www.experts-exchange.com/questions/21913332/sql-statement.html
https://www.experts-exchange.com/questions/21913332/sql-statement.html
ASKER