integer to string (1 Viewer)

tommaz

New member
Local time
Tomorrow, 01:35
Joined
Sep 14, 2007
Messages
7
Hi everyone,

I'm very new to Access, but I keep learning it with the help of this forum, but came up with the problem for which I can not find solution.
i'm runing code:

Private Sub Command44_Click()
Dim rsItems As ADODB.Recordset
Dim ID As Integer
Set rsItems = New ADODB.Recordset
ID = Me.txtID
rsItems.Open "SELECT * FROM tblRizika2Data WHERE (Data_ID= [ID])", CurrentProject.Connection, adOpenKeyset, adLockReadOnly
With rsItems
While Not .EOF
lstKlasifikacija.Selected(rsItems.Fields("Rizika_ID")) = True

.MoveNext
Wend
End With

rsItems.Close
Set rsItems = Nothing
End Sub

And get error message: "No value given for one or more parameters"
If I change ID to the exact number it stands for in the tblRizika2Data - everything works fine.

Any Ideas what is vrong with this code? Or maybe similar problem was already solved in this forum yet? I would be very thankful for the link to that post :)
 

Alc

Registered User.
Local time
Today, 18:35
Joined
Mar 23, 2007
Messages
2,407
This should work better than
"SELECT * FROM tblRizika2Data WHERE (Data_ID= [ID])"
Code:
"SELECT * FROM tblRizika2Data WHERE (Data_ID = " & [ID] & ")"
 

tommaz

New member
Local time
Tomorrow, 01:35
Joined
Sep 14, 2007
Messages
7
Thank's Alc This works perfectly ;)
 

Alc

Registered User.
Local time
Today, 18:35
Joined
Mar 23, 2007
Messages
2,407
Glad to help. Thanks for letting me know it worked.
 

Users who are viewing this thread

Top Bottom