rot13 Posted October 3, 2005 Posted October 3, 2005 "No value given for one or more required parameters." This is the error I get on the .Fill line of this code. '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() Any idea what is wrong? I'm in a hurry to go somewhere right now... be back in an hour or two... I'll explain more then if needed... later Quote
Administrators PlausiblyDamp Posted October 3, 2005 Administrators Posted October 3, 2005 Check you have spelt all table and column names correctly - failure to do so often results in this error when using access. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rot13 Posted October 3, 2005 Author Posted October 3, 2005 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... I'm such an idiot. :P thx Quote
rot13 Posted October 3, 2005 Author Posted October 3, 2005 I have fixed the spelling errors and the exception is still thrown. I'm sure it's just the SQL statement is not set up right. I'll explain what I'm 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: | Part Number | Customer | Description | Quantity | Due Date | and the fields are | Parts.PartID | Customers.CustomerID | Parts.Description | LineItems.Quantity | LineItems.DueDate | Thanks in advance for any help. I hope this was clear, I just typed it out real quick. Quote
*Experts* Nerseus Posted October 3, 2005 *Experts* Posted October 3, 2005 I'd 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 you're selecting from 3 tables but the WHERE is only filtering LineItems (QuantityComplete < Quanity). Where's the join criteria for Parts and Customers? If you run the query in Access, I think you'll find PD's advice is true - it's 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 Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
rot13 Posted October 3, 2005 Author Posted October 3, 2005 I'd 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 you're selecting from 3 tables but the WHERE is only filtering LineItems (QuantityComplete < Quanity). Where's the join criteria for Parts and Customers? If you run the query in Access, I think you'll find PD's advice is true - it's 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.