Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble opening recordset 1

Status
Not open for further replies.

sanders720

Programmer
Aug 2, 2001
421
0
0
US
I am trying to open a recordset...

For some reason, I am getting the error "Run-time error '-2147217904 (80040e10)':
No value given for one or more required parameters.

Thanks in advance for the help!


Dim rsmax As ADODB.Recordset
Dim sqlmax As String
sqlmax = "SELECT Max(BubbleNo) as Expr1 from tblBOM WHERE (((tblBOM.JobNo) = " & JobNo & "));"
Set rsmax = New ADODB.Recordset
rsmax.Open sqlmax, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\deepblue\EngineeringBOM\Data\EngineeringBOM_data.mdb;Persist Security Info=False", adOpenStatic, adLockReadOnly, adCmdText
 
Hi,
A couple of items to look for. Does your statement work when you hard code a job number? Is your job number field a number field or a char field?
You can shorten the statement to look like this:

sqlmax = "SELECT Max(BubbleNo) as Expr1 from tblBOM WHERE tblBOM.JobNo = " & JobNo

If JobNo is a string then it should look like this:

sqlmax = "SELECT Max(BubbleNo) as Expr1 from tblBOM WHERE tblBOM.JobNo = '" & JobNo & "'"

John

*********************
John Nyhart
*********************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top