Solved

execute multiple queries

Posted on 2006-06-15
4
184 Views
Last Modified: 2010-04-30
my application requires the user to type in a parcel number. With that parcel Id I would like to search one table and a view. Basically the one table is applications already processed according to parcel Id. The view(sql server 2000) is data from a another DataBase that applications have not been done on it. I want the app to search the table, if no entries are found(according to the Parcel Id user typed in) then search the view(there will always be data associated with that parcel Id in the view)If there is app already the use can review it, if there is not the user can create a new app from the basic info found in the "view".
My view works fine, My table works fine. I just can't get them to work together.

0
Comment
Question by:ircpamanager
  • 2
4 Comments
 
LVL 5

Author Comment

by:ircpamanager
ID: 16912658
i am using ado and i am displaying results of query in textboxes on form
thanks in advance
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 16918014
From what you said I understand that your table and view are not in the same database. SO,

Just use separate 'connection strings ' for the 2 databases. Open the table and view separately and check.
0
 
LVL 5

Author Comment

by:ircpamanager
ID: 16919432
I am sorry if I explained it that way. the table and view are attached to the same database.
0
 
LVL 5

Accepted Solution

by:
patingsadagat earned 500 total points
ID: 16923749
Dim rs As New ADODB.Recordset, rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
   
cn.Open "your connection string"
cn.CursorLocation = adUseClient
   
rs.Open "Select * From Table1 where ParcelID='" & txtParcelID.Text & "'"
if rs.eof then
     rs1.Open "Select * From View1 where ParcelID='" & txtParcelID.Text & "'"
     if rs1.eof then
          'code to add new values here
     else
          'code to display values to textboxes here
     end if
     rs1.close
     set rs1 = nothing
else
      'code to display values to textboxes here
end if
rs.close
cn.close
set rs = nothing
set cn=nothing
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now