|
-
Nov 18th, 2009, 02:11 AM
#1
Thread Starter
New Member
VB6 Halp required
Hey guys im designing a system to search a MS Access database and I just cant seem to get it working.
Dim key As String, str As String
Dim count, a As Integer
count = frmAdmin.Adodc1.Recordset.RecordCount
key = " "
key = InputBox("Enter the policy No whose details u want to know: ")
'For a = 1 To count
'If key = frmAdmin.Adodc1.Recordset.Fields(0) Then
'Call MsgBox("Client Exists", vbOKOnly + vbInformation, "Client Exists")
'Else
'Call MsgBox("client does not exist", vbOKOnly + vbInformation, "Client does not exist")
' End If
'Next a
'str = "select * from Client where [Policy Number]=" & key
'frmAdmin.Adodc1.Recordset.Open str
'frmAdmin.Adodc1.Recordset.Close
While Not (frmAdmin.Adodc1.Recordset.EOF) And found = False
If frmAdmin.Adodc1.Recordset.Fields(0) = key Then
Call MsgBox("record exists", vbOKOnly + vbInformation, "Record found")
found = True
Else
Call MsgBox("record does not exist", vbOKOnly + vbInformation, "record not found")
End If
frmAdmin.Adodc1.Recordset.MoveNext
Wend
thats the code Im currently using. as you can see Im using ADODC and I even tried using SQL to no avail...Please assist....
-
Nov 18th, 2009, 05:53 AM
#2
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 20th, 2009, 03:03 AM
#3
Thread Starter
New Member
Re: VB6 Halp required
Dim key As String, str As String
Dim count, a As Integer
count = frmAdmin.Adodc1.Recordset.RecordCount
key = " "
key = InputBox("Enter the policy No whose details u want to know: ")
'set up the recordset, and load the data:
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "SELECT Client where Policy_Number= '" & key & "'", adOpenStatic, adLockReadOnly, adCmdText
If rs.EOF Then
MsgBox "No data found!"
Else
'..do what we want with the data in this record
MsgBox rs.Fields("field1").Value
End If
'tidy up
rs.Close
Set rs = Nothing
End Sub
the error im getting is Run time error 3001: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
HELP....
-
Nov 20th, 2009, 03:13 AM
#4
Re: VB6 Halp required
You have to include the connection also...
Code:
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & App.Path & "\abc.mdb"
cn.Open
Make sure, you had added reference to Microsoft ActiveX Data Objects
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 20th, 2009, 03:15 AM
#5
Re: VB6 Halp required
First of all, go through our Database FAQ section to learn about ADO
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 20th, 2009, 07:15 AM
#6
Re: VB6 Halp required
Thread moved to 'Database Development' forum (the 'VB6' forum is only meant for questions which don't fit in more specific forums)
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
|