Welcome to Dream.In.Code
Become a VB Expert!

Join 150,137 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,236 people online right now. Registration is fast and FREE... Join Now!




Query

 
Reply to this topicStart new topic

Query

masipro
12 Jul, 2008 - 10:34 PM
Post #1

New D.I.C Head
*

Joined: 8 Jul, 2008
Posts: 40



Thanked: 1 times
My Contributions
I am using MS Access as back end with Front end VB6. In my Access Table i made a query which exactly run what i wish; when i used to copy the data from this querty to another table using vb statements, it shows wrong information (rarely shows correct information for the same for some times) i.e the query has 21 rows, and when i use rs1.recordcount (where rs1 is new ADODB.Recordset)in vb it often shows 20 records found (i used msgbox for no. or records to show whether it is correct) i surprised to see, also it rarely shows as 21 record found after some times. Please could you help me in this regard.
Though i have not attached any database file or vb codings i have executed, i hope you would find what mistake i have done. waiting for reply

Regards
Masipro
User is offlineProfile CardPM
+Quote Post

dineeshd
RE: Query
13 Jul, 2008 - 04:01 AM
Post #2

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 579



Thanked: 16 times
Dream Kudos: 575
My Contributions
An assumption without seeing the code is very difficult. You should post your code, so that we can help you out.
User is offlineProfile CardPM
+Quote Post

masipro
RE: Query
14 Jul, 2008 - 04:28 AM
Post #3

New D.I.C Head
*

Joined: 8 Jul, 2008
Posts: 40



Thanked: 1 times
My Contributions
QUOTE(masipro @ 12 Jul, 2008 - 11:34 PM) *

I am using MS Access as back end with Front end VB6. In my Access Table i made a query which exactly run what i wish; when i used to copy the data from this querty to another table using vb statements, it shows wrong information (rarely shows correct information for the same for some times) i.e the query has 21 rows, and when i use rs1.recordcount (where rs1 is new ADODB.Recordset)in vb it often shows 20 records found (i used msgbox for no. or records to show whether it is correct) i surprised to see, also it rarely shows as 21 record found after some times. Please could you help me in this regard.
Though i have not attached any database file or vb codings i have executed, i hope you would find what mistake i have done. waiting for reply

Regards
Masipro


CODE


Ok, the code is as follows, also i have attached *.mdb zipped file for your reference.

Set rs8 = New ADODB.Recordset

Set rs8 = GetTable("SELECT a.Buyer_ID, a.Dept, a.Season, a.Order_No, a.Plan_No, a.Style, IIf([b].[opening]<>0,[b].[opening],0) AS Opening, IIf([c].[totarr]<>0,[c].[totarr],0) AS TotArr, IIf([c].[totdesp]<>0,[c].[totdesp],0) AS TotDesp FROM (UnionBankstock as a LEFT JOIN Bankstocktemp as b ON (a.Style = b.Style) AND (a.Plan_No = b.Plan_No) AND (a.Order_No = b.Order_No) AND (a.Order_No = b.Order_No) AND (a.Season = b.Season) AND (a.Dept = b.Dept) AND (a.Buyer_ID = b.Buyer_ID)) LEFT JOIN MonthlyProduction as C ON (a.Style = c.Style) AND (a.Plan_No = c.Plan_No) AND (a.Order_No = c.Order_No) AND (a.Season = c.Season) AND (a.Dept = c.Dept) AND (a.Buyer_ID = c.Buyer_ID)")


If rs8.RecordCount > 0 Then
MsgBox rs8.RecordCount & " found"
rs8.MoveFirst
While Not rs8.EOF() = True
Set rs9 = New Recordset
Set rs9 = GetTable("MyBankStock")
rs9.AddNew
rs9(0) = rs8(0)
rs9(1) = mnth
rs9(2) = rs8(1)
rs9(3) = rs8(2)
rs9(4) = rs8(3)
rs9(5) = rs8(4)
rs9(6) = rs8(5)
rs9(7) = rs8(6)
rs9(8) = rs8(7)
rs9(9) = rs8(8)
rs9(10) = rs8(6) + rs8(7) - rs8(8)
rs9(11) = prod

rs9.Update
rs8.MoveNext
Wend
End If

MsgBox "over"
End If




Thank you,
Masi

User is offlineProfile CardPM
+Quote Post

dineeshd
RE: Query
14 Jul, 2008 - 04:35 AM
Post #4

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 579



Thanked: 16 times
Dream Kudos: 575
My Contributions
This seems to be a problem with your Query. I can't find any database attachment here. If you provide that may be I can tell you what exactly went wrong.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 01:59AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month