473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

loading multiple tables values from access to excel into single sheet using vb6

hi my name is vishal
i am using vb6 as front-end and ms access as back-end. I dont want to use data report instead i want to export these multiple table values to excel.
i have tried a code given below:
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Dim dIsVisible As Boolean
  3. Dim inst As String
  4. Dim adoDatabase As ADODB.Connection
  5. Dim oRs As ADODB.Recordset
  6.  
  7.  
  8.  
  9. Sub getDialyzerInfo()
  10.     Me.Caption = "Dialyzer Info"
  11.     fmeDialyzerID.Visible = True
  12.     fmePatientwise.Visible = False
  13.     dIsVisible = True
  14. End Sub
  15.  
  16. Private Sub cmdGenerate_Click()
  17. Dim xlApp As Excel.Application
  18. Dim wb As Workbook
  19. Dim ws As Worksheet
  20. Dim var As Variant
  21.  
  22. Set xlApp = New Excel.Application
  23. Set wb = xlApp.Workbooks.Open("D:\Workarea\vishal\130918\dialyser.xls.xlsx")
  24. Set ws = wb.Worksheets("Sheet1")
  25. Me.Hide
  26. Dim adoDatabase As New ADODB.Connection
  27. Dim oRs As New ADODB.Recordset
  28. If (dIsVisible = True) Then
  29.         If (Trim(Text1.Text) <> "") Then
  30. adoDatabase.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
  31.                          "Dbq=tuscanDB.mdb;" & _
  32.                          "DefaultDir=" & App.Path & ";" & _
  33.                          "Uid=Admin;Pwd=;"
  34. adoDatabase.Open
  35.  oRs = adoDatabase.Execute("select r.dialysis_date,pn.patient_first_name,pn.patient_last_name, d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.technician_first_name,t.technician_last_name from dialyser d,patient_name pn, reprocessor r, techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=false and pn.status=true and d.dialyserID=('" & Text1.Text & "') order by r.dialysis_date desc,pn.patient_first_name,pn.patient_last_name", "DCS Clinical Report-For Dialyzer ID(" & Text1.Text & ")")
  36. End If
  37. Else
  38.         If cboPatientID.ListIndex = 0 Then
  39.             Set oRs = adoDatabase.Execute("select r.dialysis_date,pn.patient_first_name,pn.patient_last_name, d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.technician_first_name,t.technician_last_name from dialyser d,patient_name pn, reprocessor r, techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and r.dialysis_date between cdate('" & dtFrom.Value & "') and cdate('" & dtTo.Value & "') and t.technician_id=r.technician_id and d.deleted_status=false and pn.status=true order by r.dialysis_date desc,pn.patient_first_name,pn.patient_last_name", "DCS Clinical Report - Patient wise")
  40.         Else
  41.         Set oRs = adoDatabase.Execute("select r.dialysis_date,pn.patient_first_name,pn.patient_last_name, d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.technician_first_name,t.technician_last_name from dialyser d,patient_name pn, reprocessor r, techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and r.dialysis_date between cdate('" & dtFrom.Value & "') and cdate('" & dtTo.Value & "') and d.patient_id=" & Left(cboPatientID.List(cboPatientID.ListIndex), InStr(cboPatientID.List(cboPatientID.ListIndex), "|") - 1) & " and t.technician_id=r.technician_id and d.deleted_status=false and pn.status=true order by r.dialysis_date desc,pn.patient_first_name,pn.patient_last_name", "DCS Clinical Report - Patient wise")
  42.         End If
  43.         End If
  44.     Unload Me
  45. End Sub
but i get error(run-time)"Invalid procedure call or argument"
Can anyone help me please?
Sep 19 '13 #1
1 1310
Rabbit
12,516 Expert Mod 8TB
On which line of code do you get the error?
Sep 19 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Katrina | last post by:
I am trying to write a piece of code that will search through a number of different tables (current one being tableNm) to look for a specific street name that has been entered by the user and saved...
6
by: Shashi | last post by:
I have developed ASP.Net application using .Net 1.1 Framework. When the user clicks image file through Java script I am using my search window as below. QueryString =...
3
by: bader | last post by:
I need some assistance with a format in Access. I need several tables to use the same pool of autogenerated numbers (badge numbers) and automatically fill that value upon each record generation. I...
1
by: tezza98 | last post by:
I need some help. Im using a dtsrun command to import 9 tables into an Access database, most of the tables have about 1000 rows, but one has 20000+ rows and grows everyday. Im Using Access 2003...
0
by: eBob.com | last post by:
I am creating an Excel 2002 sheet programmatically using VB.Net. It all works fine. But now I'd like to add a photograph to each row. I've done searches but all the hits I get must be for VBA...
5
by: Kimg0123 | last post by:
I would like to be able to append data from multiple tables into a single summary table using either an event procedure for the On Load or On Open properties on a form, but cannot seem to figure this...
2
by: danorourke99 | last post by:
Hi, In my Access database I have a table (dbo_000_DataCubeProcessing) which contains a list of tables that I need to export to Excel on a regular basis along with a checkbox for each. Once I...
6
ak1dnar
by: ak1dnar | last post by:
Please have a look at this sample tables. Table : users 1001 | USER-1 1002 | USER-2 1003 | USER-3 Table: Schools
0
by: shakthisarav | last post by:
Hi, problem: Add one combo to the excel spreadsheet. let it be in cell 'd1'.the combo should contain items as lock & unlock.when we click on lock the cells a1:c1 must be disabled. the cell e1...
6
by: srikanya | last post by:
Hi, I have a database with 10 tables and I want to export all table data into excel file.But there should be only one excel file with different sheets in it, each containing different tables data.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.