1,105,391 Community Members

Error in VB6 : No value given for one or more required parameters

Member Avatar
nick_hunk91
Newbie Poster
5 posts since Dec 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I am preparing a Business Management System, in which the user enters the details of purchase and sale, where item number identifies the stock availability. Suppose i purchased item1 as Business Stock, it was not in the stock, it is updated in table 4. But if it exists, i gave an SQL query, with Update Command.
Quantity= qty is updating, but Quantity = Quantity + qty is not working.

con.Execute ("update table4 set Quantity = Quantity + qty where Item_code='" & Text3.Text & "'")

While executing this command, the sustem shows the error specified in the title. The code is given Below, if anyone thinks that it can be solved, kindly revert me at [email snipped]


Dim con As New ADODB.Connection
Dim res As New ADODB.Recordset
Dim res1 As New ADODB.Recordset
Dim sql As String
Dim sql2 As String
Dim sql1 As String
Dim qty As String
Dim sql3 As String



Private Sub Command1_Click()
Text7.Text = Val(Text5.Text) * Val(Text6.Text)
sql = ""
sql = sql + "insert into table2 values('" & Text2.Text & "','" & Text1.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "')"
res.Open "select * from table2 where reciept='" & Text2.Text & "'", con, adOpenDynamic, adLockOptimistic
If res.EOF = False Then
MsgBox "Bill no. already Exists", vbCritical, "Verification"

Text2.Text = ""
res.Close

Else
con.Execute sql
MsgBox "Bill Submitted"
res.Close
End If
sql1 = ""
sql1 = sql1 + "insert into table4 values('" & Text3.Text & "','" & Text5.Text & "')"
res1.Open "select * from table4 where item_code='" & Text3.Text & "'", con, adOpenDynamic, adLockOptimistic

If res1.EOF = False Then
   
    
MsgBox "Item Already Exists in Stock", vbCritical, "Verification"
res1.Close
qty = Text5.Text

con.Execute ("update table4 set Quantity = Quantity + qty where Item_code='" & Text3.Text & "'")


Else
con.Execute sql1

res1.Close
End If
End Sub

Private Sub Command2_Click()
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub

Private Sub Form_Load()
Text1.Text = Date
End Sub

Private Sub Form_Activate()
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database21.mdb;Persist Security Info=False"
con.Open
End Sub

Attachments also there, please help if you can, i want the project complete by tomorrow. :sweat:

Attachments screen.jpg 21.6KB my1.zip (179.01KB)
Member Avatar
BitBlt
Practically a Posting Shark
895 posts since Feb 2011
Reputation Points: 442 [?]
Q&As Helped to Solve: 163 [?]
Skill Endorsements: 16 [?]
Featured
 
1
 

Line 39 should probably look something like this:

con.Execute ("update table4 set Quantity = Quantity + " & qty & " where Item_code='" & Text3.Text & "'")

Or, for consistency's sake, get rid of line 37 and change line 39 to:

con.Execute ("update table4 set Quantity = Quantity + " & Text5.Text & " where Item_code='" & Text3.Text & "'")

Hope this helps.

Member Avatar
nick_hunk91
Newbie Poster
5 posts since Dec 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Line 39 should probably look something like this:

con.Execute ("update table4 set Quantity = Quantity + " & qty & " where Item_code='" & Text3.Text & "'")

Or, for consistency's sake, get rid of line 37 and change line 39 to:

con.Execute ("update table4 set Quantity = Quantity + " & Text5.Text & " where Item_code='" & Text3.Text & "'")

Hope this helps.

Man, Thank you so much, i was stuck in this situation past one week. This being my very first software for minor project, i was stuck. And the thing is, 3 assistant professors, 7 engineers working in a different companies and 6 students from my batch, weren't able to find the solution. Thanks so much. Stay in touch man. :cool:

Member Avatar
BitBlt
Practically a Posting Shark
895 posts since Feb 2011
Reputation Points: 442 [?]
Q&As Helped to Solve: 163 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

Glad to help. Be sure to mark the thread "Solved".

Also, one thing about coding errors...sometimes it has nothing to do with how smart or experienced you are...sometimes you just get in one of those situations where you beat your head against a problem for hours, then someone peeks over your shoulder, looks at it for 10 seconds, and says, "Oh, the problem is right THERE." No reflection on the abilities of the coder, it has happened to all of us at one time or another. Keeps us all humble.

We just have to make sure it doesn't happen OFTEN... :D

Question Answered as of 2 Years Ago by BitBlt
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article