Results 1 to 2 of 2

Thread: Excel Records using DSN

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    83

    Excel Records using DSN

    Dear Freinds
    i m new with Excel. i m trying to retrieve data from EXCEL.
    This code is not working gives me some error .Although OPenDb Procedure works fine. but when i call the Procedure GetRecord then error arises Microsoft jet database engine cannot find the input table.


    Also how can i get the records from specific column. can insert records into the column,row.



    Din Cn as new Adodb.connection
    Dim ConString As String

    Private Sub Command1_Click()
    Call GetRecord
    End Sub

    Public Sub OpenDB()

    ConString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=EX"
    If Cn.State = 1 Then
    Cn.Close
    Else
    Cn.Open ConString
    End If


    End Sub

    Public Sub GetRecord()

    Dim Rs As New ADODB.Recordset
    Rs.ActiveConnection = Cn

    Rs.Open "Select * from sheet1"

    If Rs.EOF Then
    MsgBox "No DATA"
    Else
    MsgBox Rs.Fields(1)
    End If



    End Sub

    Private Sub Form_Load()
    Call OpenDB
    End Sub


  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Excel Records using DSN

    A perfect tutorial for you....
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width