No value given for parameter

rot13

Well-known member
Joined
Jun 12, 2004
Messages
53
"No value given for one or more required parameters."

This is the error I get on the .Fill line of this code.

[VB]
Select Command
Dim txtSelectCommand As String
txtSelectCommand = "SELECT Customers.CustomerID, Parts.PartID, Parts.Description, " & _
"LineItems.Quanity, LineItems.QuantityComplete, " & _
"LineItems.DueDate FROM Customers, Parts, " & _
"LineItems WHERE LineItems.QuantityComplete < LineItems.Quanity"

Set connection and create DataAdapter and DataSet
Dim dbConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""Manufacturing Manager.mdb""")
Dim daPendingSales As New OleDbDataAdapter(txtSelectCommand, dbConnection)
Dim dsPendingSales As New DataSet("dsPendingSales")

Fill the DataSet
daPendingSales.Fill(dsPendingSales)

Set the grids DataBinding
Me.gridPendingSales.SetDataBinding(dsPendingSales, "ProductOrders")
Me.gridPendingSales.RetrieveStructure(True)
Me.gridPendingSales.Refetch()

Close Connection
dbConnection.Close()
[/VB]

Any idea what is wrong? Im in a hurry to go somewhere right now... be back in an hour or two... Ill explain more then if needed...

later
 
PlausiblyDamp said:
Check you have spelt all table and column names correctly - failure to do so often results in this error when using access.
Heh... quantity is spelled wrong... Im such an idiot. :P

thx
 
I have fixed the spelling errors and the exception is still thrown. Im sure its just the SQL statement is not set up right. Ill explain what Im doing now that I have time.

I am making a shipping program for my parents machine shop. When a new product order (P.O.) comes in, the secretary enters in all of the line items on that P.O. into the program. When we ship parts, she finds the order on the Pending Sales grid control and adds a shipment to it. It can be a partial shipment, which is why I have the WHEN part of it like it is, to make sure it still shows up until the QuantityComplete is >= Quantity (on order)

I have a ProductsOrder table, a Parts table, a LineItems table, and a Customer table (I have more, but those are the only relevant ones)

The LineItems table has a relationship to Customers, Parts, and ProductOrders tables.

The following is how the grid is setup, and what info needs to be pulled for the the columns:

[VB]| Part Number | Customer | Description | Quantity | Due Date |[/VB]

and the fields are

[VB]| Parts.PartID | Customers.CustomerID | Parts.Description | LineItems.Quantity | LineItems.DueDate |[/VB]

Thanks in advance for any help. I hope this was clear, I just typed it out real quick.
 
Id suggesting printing out your string, txtSelectCommand in your first sample code, and running that from inside Access. I see a problem in your query in that youre selecting from 3 tables but the WHERE is only filtering LineItems (QuantityComplete < Quanity). Wheres the join criteria for Parts and Customers?

If you run the query in Access, I think youll find PDs advice is true - its most likely a mis-spelled column or table that Access is assuming is a parameter. If you run this in Access, it may provide more help on which column/table is spelled wrong.

-ner
 
Nerseus said:
Id suggesting printing out your string, txtSelectCommand in your first sample code, and running that from inside Access. I see a problem in your query in that youre selecting from 3 tables but the WHERE is only filtering LineItems (QuantityComplete < Quanity). Wheres the join criteria for Parts and Customers?

If you run the query in Access, I think youll find PDs advice is true - its most likely a mis-spelled column or table that Access is assuming is a parameter. If you run this in Access, it may provide more help on which column/table is spelled wrong.

-ner
ok, I will try this as soon as I get to that computer.
 
Back
Top