|
-
Aug 16th, 2007, 12:15 PM
#1
Thread Starter
Junior Member
[RESOLVED] database Access using Vb
I am trying to get data from MS access table using the code below. I am using VB6.3 and I have created ODBC as my_cn point to database file (.mbd). When I run this code, I get a runtime error 3001 "Argumant are of wrong type, are out of acceptable range or are in conflict with one another".
When I click debug it highlights "rs.open..." code line.
Please let me kow what missing.
Thanks
Question_1
CODE:
Private Sub form_load()
Dim rs As ADODB.Recordset
strSQL = "SELECT * from MasterTable where SWCR = 13;"
Set rs = New ADODB.Recordset
rs.Open strSQL, my_cn, adOpenStatic, adLockReadOnly
retrieveValue = rs(0).Value
MsgBox ("value:" & retrieveValue)
rs.Close
Set rs = Nothing
End Sub
Last edited by sprasoon; Aug 16th, 2007 at 12:53 PM.
-
Aug 16th, 2007, 12:18 PM
#2
Re: database Access using Vb
VB6.3 would be Access VBA
Moved From FAQ section
-
Aug 16th, 2007, 12:27 PM
#3
Frenzied Member
Re: database Access using Vb
If you're in Access you don't use ODBC. Are you trying to connect to a Mysql db or similar? What is the code where you set your connection?
Tengo mas preguntas que contestas
-
Aug 16th, 2007, 12:44 PM
#4
Thread Starter
Junior Member
Re: database Access using Vb
Yes I am in MSAccess, have created a form bound to a table. I am trying to extract data from the table 'MasterTable' into a local variable in VB which I can use later in my code to apply to some equations.
I am not a hardcore software. I am more into embedded tech so quite new to VB interface to MSaccess database.
-
Aug 16th, 2007, 01:02 PM
#5
Thread Starter
Junior Member
Re: database Access using Vb
Never Mind I got it myself. thanks anyways.
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
|