i have a table emp ( in oracle ) with the following structure : empid number(4); name varchar2(15); i have created a search form to search...

How It Works

Get an answer in three easy steps. Here's how it works...

Ask Your Question

1. Ask Your Question

Enter your programming question at the top of this page and click Get An Answer.

Pick Your Priority

2. Pick Your Priority

Tell us how quickly you want your programming question answered.

Get An Answer

3. Get An Answer

Connect with your programmer via online chat or telephone call.

Answer

Customer
i have a table emp ( in oracle ) with the following structure : empid number(4); name varchar2(15); i have created a search form to search either by empid or name. searching by empid is working fine with this code however searching with the name produces an unsuccessful search. if i remove the condition : "If rs.BOF And rs.EOF Then" then it gives an error "either BOF or EOF is true". although its not the case when i'm searching for an id of the same person. this is the code i'm using. any help would be much appreciated. Private Sub cmdsearch_Click() Dim strid, strname As String connect ' function for the connection If Option1.Value = True Then ' search by empid a = Val(txtsearch.Text) strid = "select * from emp where empid = " & a & " " Conn.Open rs.Open strid, Conn If rs.BOF And rs.EOF Then MsgBox "No such record exists ", , "Search" rs.Close Set rs = Nothing Conn.Close Set Conn = Nothing Exit Sub Else txtempid.Text = rs!empid txtname.Text = rs!Name rs.Close Set rs = Nothing Conn.Close Set Conn = Nothing End If txtsearch.Text = Empty End If If Option2.Value = True Then ' search by name b = txtsearch.Text strname = "select * from emp where name like ' " & b & " ' " Conn.Open rs.Open strname, Conn If rs.BOF And rs.EOF Then MsgBox "No such record exists ", , "Search" rs.Close Set rs = Nothing Conn.Close Set Conn = Nothing Exit Sub Else txtempid.Text = rs!empid txtname.Text = rs!Name rs.Close Set rs
Posted

quoteTestimonialsquote

About ExpertHelp

ExpertHelp is changing the way you connect with service professionals.

Whether you have a quick question while preparing your taxes, troubleshooting a computer problem, or need to hire an attorney, ExpertHelp is the most convenient and affordable way to connect with the right service professional to get the job done.

ExpertHelp has been in business since 2011, is an A+ Rated Better Business Bureau accredited member, and offers a 100% satisfaction guarantee on every question you ask!

More Programming Questions...

Ask Your Programming Question & Get An Answer Now!