sub command1_click() dim strwhere as string if isnull(text1.value)=false then strwhere=strwhere & " and field1='" & text1.value & "'" end if if isnull(text2.value)=false then strwhere=strwhere & " and field2='" & text2.value & "'" end if if isnull(text3.value)=false then strwhere=strwhere & " and field3='" & text3.value & "'" end if dim strsql as string strsql="select * from tableName where field_deleted=false " & strwhere dim conn as stringend sub
sub command1_click() dim strwhere as string if isnull(text1.value)=false then strwhere=strwhere & " and field1='" & text1.value & "'" end if if isnull(text2.value)=false then strwhere=strwhere & " and field2='" & text2.value & "'" end if if isnull(text3.value)=false then strwhere=strwhere & " and field3='" & text3.value & "'" end if dim strsql as string strsql="select * from tableName where field_deleted=false " & strwhere dim strconn as string dim conn as new adodb.connection dim rs as new adodb.recordset conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\1.mdb;User ID=admin;Password=rr;Jet OLEDB:Database Password=1" rs.open conn,1,1 do until rs.eof ... rs.movenext loop rs.close set rs=nothingend sub
dim strwhere as string if isnull(text1.value)=false then
strwhere=strwhere & " and field1='" & text1.value & "'"
end if
if isnull(text2.value)=false then
strwhere=strwhere & " and field2='" & text2.value & "'"
end if
if isnull(text3.value)=false then
strwhere=strwhere & " and field3='" & text3.value & "'"
end if
dim strsql as string
strsql="select * from tableName where field_deleted=false " & strwhere
dim conn as stringend sub
dim strwhere as string if isnull(text1.value)=false then
strwhere=strwhere & " and field1='" & text1.value & "'"
end if
if isnull(text2.value)=false then
strwhere=strwhere & " and field2='" & text2.value & "'"
end if
if isnull(text3.value)=false then
strwhere=strwhere & " and field3='" & text3.value & "'"
end if
dim strsql as string
strsql="select * from tableName where field_deleted=false " & strwhere
dim strconn as string
dim conn as new adodb.connection
dim rs as new adodb.recordset
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\1.mdb;User ID=admin;Password=rr;Jet OLEDB:Database Password=1"
rs.open conn,1,1
do until rs.eof
...
rs.movenext
loop
rs.close
set rs=nothingend sub