Please tell me the necessary code to read a first table for information then search a second table. If no match, add a new record to the second table. Thanks!

Recommended Answers

All 2 Replies

try this

rs.open "select mycol from mytable where mycol='"+myvalue+"'",mycon
if rs.eof=false then
rs1.open "select * from mytable1 where mycol1='"+rs(0)+"'",mycon
if rs.eof<>false then
rs1.addnew
rs1(0)=myval1
rs1(1)=myval2
.
.
.
rs1.update
endif
rs1.close
rs.close
endif

keep rs.close after endif

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.