Hello everyone,
I would like to ask on how to have two ADODB Connection in Access, so that i will be able to retrieve two recordset from my table and display it on my form.
I am able to retrieve the recordset for my rsMax. And now i would like to add in the runningno database to retrieve the recordset to display on my form.
I tried adding in the runningno as a recordset as shown in my code below, and i get error"The connection cannot be used to perform this operation. It is either closed or invalid in this context"
What can i do to resolve this problem? Thankyou.
Below is the code that i have try:
Set con = CurrentProject.connection
Set rsMax = New ADODB.Recordset
'retrieve data from Max
rsMax.Open "SELECT PO,Content,Reference,elDate,Fabrication,Width,Color,Weight,SUM(Qty)as SumofQty," & _
"SUM(Sqty) as [SumofSqty from Max " & _
"GROUP BY Fabrication,Width,Color,DelDate,PO,Weight,Content,Reference;", con, adOpenDynamic, adLockOptimistic
Code for runningNo:
Dim connection As ADODB.connection
Dim rsRunningNo As ADODB.Recordset
Set connection = CurrentProject.connection
Set rsRunningNo = New ADODB.Recordset
'retrieve data from RunningNo
rsRunningN
pen "SELECT CompanyCode,YearCode,PONumber from RunningNo"
I would like to ask on how to have two ADODB Connection in Access, so that i will be able to retrieve two recordset from my table and display it on my form.
I am able to retrieve the recordset for my rsMax. And now i would like to add in the runningno database to retrieve the recordset to display on my form.
I tried adding in the runningno as a recordset as shown in my code below, and i get error"The connection cannot be used to perform this operation. It is either closed or invalid in this context"
What can i do to resolve this problem? Thankyou.
Below is the code that i have try:
Set con = CurrentProject.connection
Set rsMax = New ADODB.Recordset
'retrieve data from Max
rsMax.Open "SELECT PO,Content,Reference,elDate,Fabrication,Width,Color,Weight,SUM(Qty)as SumofQty," & _
"SUM(Sqty) as [SumofSqty from Max " & _
"GROUP BY Fabrication,Width,Color,DelDate,PO,Weight,Content,Reference;", con, adOpenDynamic, adLockOptimistic
Code for runningNo:
Dim connection As ADODB.connection
Dim rsRunningNo As ADODB.Recordset
Set connection = CurrentProject.connection
Set rsRunningNo = New ADODB.Recordset
'retrieve data from RunningNo
rsRunningN
