sunshine737
asked on
runtime error - runtime error '-2147217904 (80040e10)' - no value give for one or more required parameteres
Hello
Im doing a vba program and i have placed a combobox and retreived data from the Access database. Now when the user selects a value from the combo box, i want to display some other data from the table. i have tried this but im getting a runtime error 'runtime error '-2147217904 (80040e10)' - no value give for one or more required parameteres' on this line - rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)=[ result]))" , myConn1
----
Private Sub ComboBox1_Change()
Dim result As String
result = ComboBox1.Value
MsgBox result
Dim myConn1 As ADODB.Connection
Dim rs1 As ADODB.Recordset
Set myConn1 = New ADODB.Connection
myConn1.ConnectionString = "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=G:Hello\db2.mdb;Per sist Security Info=False;"
myConn1.Open
Set rs1 = New ADODB.Recordset
Set rs1.ActiveConnection = myConn
rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)=[ result]))" , myConn1
MsgBox rs1(FName)
------------
could anyone help me solving this error
thanks
Im doing a vba program and i have placed a combobox and retreived data from the Access database. Now when the user selects a value from the combo box, i want to display some other data from the table. i have tried this but im getting a runtime error 'runtime error '-2147217904 (80040e10)' - no value give for one or more required parameteres' on this line - rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)=[
----
Private Sub ComboBox1_Change()
Dim result As String
result = ComboBox1.Value
MsgBox result
Dim myConn1 As ADODB.Connection
Dim rs1 As ADODB.Recordset
Set myConn1 = New ADODB.Connection
myConn1.ConnectionString = "Provider=Microsoft.Jet.OL
myConn1.Open
Set rs1 = New ADODB.Recordset
Set rs1.ActiveConnection = myConn
rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)=[
MsgBox rs1(FName)
------------
could anyone help me solving this error
thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just take out the single quotes
Sorry I didnt notice that it was an id field
rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)=" & result & "))", myConn1
Sorry I didnt notice that it was an id field
rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)="
ASKER
which single quotes ?????
I believe plg and I are both correct - your msgbox won't work without either of our modifications.
ASKER
rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)=" & result & "))", myConn1
MsgBox rs1(FName)
i have done this and is giving me an error as runtime error '3265'
item cannot be found in the collection corresponding to the requested name or ordinal
MsgBox rs1(FName)
i have done this and is giving me an error as runtime error '3265'
item cannot be found in the collection corresponding to the requested name or ordinal
ASKER
ok i have got it , i put comments and its working
but how can i diplay this value in the text field
but how can i diplay this value in the text field
ASKER
sorry i mean quotes
rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)=" & result & "))", myConn1
MsgBox rs1("FName")
can somebody tell me how to display the samething in the text field please ...........urgent
thanks
rs1.Open "SELECT Employees.FName FROM Employees WHERE (((Employees.EmployeeID)="
MsgBox rs1("FName")
can somebody tell me how to display the samething in the text field please ...........urgent
thanks
text1.text = rs1.Fields("FName").Value
even
text1.text = rs1("FName")
text1.text = rs1("FName")
ASKER
when im using this its giving an error as data type mismatch in criteria expression
actually i think last quesry is right as i tried it in the access and after giving the number from combobox its getting the fname value..........