AboutRavindra Expertise visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel.
Optional:
1)a large number of people want me to do work which takes some time and effort. Pl.note that i would like to be paid for such work.
2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time.
3) if you are pleased with my reply you could consider a donation of 1$.
4) you can visit my website http://ravindra.coolpage.biz (under constrn)
Experience
Past/Present clients project work for a Norway company, and a Canadian company completed. Freelance Project work and Teaching
teaching vb
Question QUESTION: I ve got a simple program usin ADO to read from as database. I already populate a combobox with the "Company Name" and it updates all the textboxes on the form when selecting a item in the combo. In a different textbox I want to enter the "company ID" to search for a specific entry but I get the following error = "Runtime-error '3001'. Arguments are of wrong type,are out of range, or are in conflict with each other.
ANSWER: let me know the code you use for getting the records
the textbox stores a string value so you need to converto integer if Id is a number. if it is a text value then your sql could be wrong.
---------- FOLLOW-UP ----------
QUESTION: Private Sub cmdQSearchEC_Click()
Dim rsECust2 As New Recordset
rsECust2.Open "Select * from Tables Order by CustID ", dbConn, adOpenStatic, adLockOptimistic
If rsECust2.BOF = False And rsECust.EOF = False Then
rsECust2.MoveFirst
rsECust2.Find "rsECust2 (0) = " & LTrim(Val(IDsearch.Text)), 0, adSearchForward
If Not rsECust2.BOF And Not rsECust2.EOF Then
End If
End If
If Not rsECust2.BOF And Not rsECust2.EOF Then
For i = 0 To 11
If Not IsNull(rsECust2.Fields(i + 1)) Then
txtECust(i).Text = rsECust2.Fields(i + 1)
Else
txtECust(i).Text = ""
End If
Next i
End If
The CustID datafield in Access is set to text.
Answer if custId is a textfield then use:
"select * from TableName where CustId=" & "'" & iDsearch & "'"
and if custid is unique you will get only one record
and your bof and eof seems funny to me and i dont understand your naming so here's a sample code;
better to have the runners nos in a combobox rather than a textbox.
'put a check mark on Project_references_Microsoft ActiveX Dataobjects library
Option Explicit
Dim cn As ADODB.Connection, rec As ADODB.Recordset
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rec = New ADODB.Recordset
cn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\ravindra\My Documents\Test_1.mdb;Persist Security Info=False")
rec.Open ("select item from testable"), cn, adOpenStatic, adLockReadOnly
'change to your table name and path
Do While Not rec.EOF
Combo1.AddItem rec.Fields(0)
rec.MoveNext
Loop
rec.Close
End Sub
Private Sub combo1_Click()
Dim esql As String
esql = "select * from testable where RunnerNo=" & "'" & Combo1 & "'"
'the above code is if RunnerNo is a string
if it is an integer
then
esql=select * from testable where RunnerNo=" & val(combo1)
rec.Open (esql), cn, adOpenStatic, adLockReadOnly
label1=rec.fields(0)
label2-rec.fields(1)
'..and so on for all fields in the table
rec.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
cn.Close
Set cn = Nothing
End Sub
'take what is needed, make changes to suit your needs
Ravindra M.G.