-
September 25th, 2011, 03:52 AM
#1
no value given for one or more parameters
help pls i always get error i use it to get values in my table consist of both numbers and text in this part of my code
brs = dbconn.Execute("SELECT * from Question where Categories = " & QuestCategory & " and Difficulty = " & Difficult & " and QNum = " & QuestNum)
(error no value given for one or more parameters)
in
Set dbconn = New ADODB.Connection
Set dbrs = New ADODB.Recordset
Dim record1 As String
Dim strapp As String
strapp = IIf(Right$(App.Path, 1) = "\", "", "\database\")
record1 = App.Path & strapp & "Custon Question Databank.mdb"
dbconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & record1 & ";Persist Security Info=False"
dbconn.Open
dbrs = dbconn.Execute("SELECT * from Question where Categories = " & QuestCategory & " and Difficulty = " & Difficult & " and QNum = " & QuestNum)
If dbrs.EOF = True Then
MsgBox "No Question Exist", vbCritical
RollCategory.Show
RollCategory.Timer1.Interval = 150
Else
QuestionDisplayLbl.Caption = dbrs!Questions
ALbl.Caption = dbrs!A
BLbl.Caption = dbrs!B
CLbl.Caption = dbrs!C
DLbl.Caption = dbrs!D
Correctans = Trim(dbrs!correct_answers)
dbrs.Close
dbconn.Close
TimerPrize2.Enabled = False
End If
-
September 25th, 2011, 08:01 AM
#2
Re: no value given for one or more parameters
Check your select statement. Make sure that all the fields referenced in your where clause actually exist in the table and are spelled exactly the same. Check the values of the variables and make sure they all contain a value.
Always use [code][/code] tags when posting code.
-
September 25th, 2011, 12:27 PM
#3
Re: no value given for one or more parameters
Use Debug.Print to save the actual SQL QUERY that gets calculated, and paste that into ACCESS connected to the same tables. Access will point to the character that fails, so it's easy to test, then put back into VB
Tags for this Thread
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
|