|
-
Apr 23rd, 2002, 01:49 AM
#1
Thread Starter
Lively Member
How to use a query for 2 grids?
Gooood morning everyone,
here's another question from me to break your heads at 
well I gues it's not so hard.
Here's the situation:
I've got a beautiful SQL query that loads into a grid. That works fine.
But I want to use the same query to use it for another grid on the same form. Only this time it needs a little extra. here's the query:
VB Code:
Dim strSQL As String
Set cn = New ADODB.Connection
cn.ConnectionString = "Data Source=spijsDB;User ID=spijs;Password=spijs;"
cn.Open
Set rs = New ADODB.Recordset
grdDatagrid2.Refresh
cn.CursorLocation = adUseServer
strSQL = " SELECT PO.Verstoring, PO.OpdrachtId, PO.Bonnummer, " & _
" PO.ReceptId, A.ArtikelNaam, RT.TypeCode, " & _
" PO.RetourID, PO.RetourHoeveelheid, " & _
" PO.Plandatum, PO.ChargeGewicht, " & _
" PO.AantalCharges, PO.AantalGereed, " & _
" PO.StartDatumTijd, PO.LotnummerWas, " & _
" PO.Bestemming, R.Versie, PO.Status, " & _
" PO.Blokkeren, PO.Commentaar, " & _
" R.ChargeGewichtKg, R.Datum, PO.ProductCode, " & _
" PO.IsOrder, R.NieuwRecept, PO.IsVerwijderd, " & _
" PO.OperatorInvoer " & _
" From ReceptType RT, Recepten R, Artikelen A, ProductieOrders PO " & _
" WHERE RT.ReceptTypeId = R.ReceptTypeId (+) and " & _
" R.ReceptId = PO.ReceptId (+) and " & _
" PO.ReceptId = A.ArtikelId and " & _
" PO.IsVerwijderd = 0 " & _
" PO.isorder = 1 " & _
" ORDER BY PO.Verstoring, PO.OpdrachtId "
rs.Open strSQL, cn
And with the second grid it needs PO.isorder = 0 instead of = 1
Anyone has a solution for this? Or do I just have to make a new query?
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|