|
-
Oct 3rd, 2012, 05:39 AM
#1
Thread Starter
Lively Member
How do i create report from 2 different access tables?
hi all,
i am doing work in vb6 using DAO. in that, am saving my form data into two Access Tables. smfields of tables are common in both tables. now i want to print one particular record. eg. in table1 one field is ID and in table2 ID is there. now i want to print all data below that particular ID. HOW?
for more clue...
Table1
ID
01
02
Table2
ID TID CName
01 01 ABC
01 02 DEF
02 01 GHI
02 02 XYZ
i want to print above data like below...
if i Select ID = 1 then
in crystal report 8.5 it prints like
TID CName
01 ABC
02 DEF
How can i do this....plz HELP for same ASAP...
thanks a lot...
kaushal
-
Oct 3rd, 2012, 09:47 PM
#2
Re: How do i create report from 2 different access tables?
CR 8.5 allow you add several tables and 'link' them using the common fields and/or keys
Also it allow you to define a filter to select records
This can be done using parameters or formulas in design time and can be modified in running time using code if you are calling the rpts from an application
but it's important that you post the code where you are calling the rpt to know which CR engine you are using (OCX or RDC)
Last edited by jggtz; Oct 3rd, 2012 at 09:54 PM.
Reason: syntax
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
Oct 6th, 2012, 06:45 AM
#3
Thread Starter
Lively Member
Re: How do i create report from 2 different access tables?
Thanks a lot for reply, JGGTZ...
am using OCX for CR Engine.
my code is as below...
Code:
Private Sub CmdPRINT_Click()
Dim strQID As Long
strQID = Trim(Text20.Text - 1)
Set rs = db.OpenRecordset("Select * from Quotation Where QID = " & strQID & " ")
Set rs1 = db.OpenRecordset("Select * from Quotation1 Where QID = " & strQID & " ")
CRpt1.ParameterFields(0) = "QID;" & Trim(Text20.Text - 1) & ";True"
CRpt1.Action = 1
End Sub
and i try it by other way...I save all data to ONE Table instead of 2 tables. its code is as below...
Code:
Private Sub cmdPRN_Click()
Dim strQID As Long
strQID = Trim(Text20.Text - 1)
Set rs1 = db.OpenRecordset("Select * from SavePrintNew Where QID = " & StrQID & " ")
CRpt1.Reset
CRpt1.ReportFileName = App.Path & "\Reports\rpt.rpt"
CRpt1.ParameterFields(0) = "QID;" & Trim(Text20.Text - 1) & ";True"
CRpt1.Action = 1
End Sub
but in this code i got " RUNTIME ERROR 20553 - Invalid Parameter Field Name" and when i Debug it, it Highlight LAST LINE of CODE which is "CRpt1.Action = 1" and
when i move my cursor on that it show this message "CRpt1.Action = <Property is Write-Only>" !!!
what suld i do in both case...plz help ASAP
thanks again...
kaushal
-
Oct 6th, 2012, 06:01 PM
#4
Re: How do i create report from 2 different access tables?
Just write this line of code before CRpt1.Action = 1
Be sure that the correct id is in the Text20
Code:
CRpt1.SelectionFormula = "{Quotation.QID } = " & Text20.Text
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
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
|