Results 1 to 6 of 6

Thread: Open "ODBC Data Sources (32bit)" control panel item

  1. #1
    Steve2276
    Guest

    Unhappy Open "ODBC Data Sources (32bit)" control panel item

    Okay, I'm a bit new to API stuff, but I've read that you can use an API to open the ODBC dialog.

    So I've added :
    VB Code:
    1. Private Declare Function SQLManageDataSources Lib "ODBC32.DLL" (ByVal hwnd) As Boolean
    at the top of my code, and then included
    VB Code:
    1. Private Sub Command1_Click()
    2.     SQLManageDataSources (hwnd)
    3. End Sub
    within the code.

    It don't work, and not being much of an API pro, I don't know what to do!
    What's wrong? I bet I've done something stupid!

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Hi Steve,

    Try this - it worked on my NT box.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SQLManageDataSources Lib "ODBCCP32.DLL" (ByVal hwnd As Long) As Boolean
    4.  
    5. Private Sub Command1_Click()
    6.  
    7. Dim bln As Boolean
    8.  
    9.     bln = SQLManageDataSources(CLng(Me.hwnd))
    10.  
    11. End Sub
    This world is not my home. I'm just passing through.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    It worked on my Win98 box too. Thanks trisuglow

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    This also works on my Win98 box, and I suspect that if you change the windows directory, it would work on an NT box.
    VB Code:
    1. Private Sub Command2_Click()
    2. 'ODBC Settings
    3. Shell "C:\Windows\control.exe" & " ODBCCP32.cpl", 1
    4. End Sub

  5. #5
    Steve2276
    Guest
    VB Code:
    1. 'dandy!

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Code:
    Shell "odbcad32", vbNormalFocus

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