demoniumz
asked on
vb 2005 sales form
hello i have make a sales form in vb 2005 the form is linked with ms access 2003.The problem is i have three fields Units in stock ,Reorder level and units in order.ok for each product i enter manually the numbers for how many i unit i have in stock reorder level and etc.I WANT when a product sold to a customer the product minus -1 -2 depend how many products a customer buy. when the units in stock go to 0 reorder level sent me a msg that need to refil it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi demoniumz,
Here is the detailed explonation
1. Before entering into the selling form means, when you are trying to load the selling form from another form, Check the quantity from the database. If the quantity is 0 then display a message to the user or else load the form.
2. You can do the quantity check after entering into the form also. When the user selects quantity option then you can check it from the database. If it is 0 then give a message to the user.
If you didn't understand it please send me your sample forms so that i can do it and send it to you.
Srinivas.B.N
Here is the detailed explonation
1. Before entering into the selling form means, when you are trying to load the selling form from another form, Check the quantity from the database. If the quantity is 0 then display a message to the user or else load the form.
2. You can do the quantity check after entering into the form also. When the user selects quantity option then you can check it from the database. If it is 0 then give a message to the user.
If you didn't understand it please send me your sample forms so that i can do it and send it to you.
Srinivas.B.N
ASKER
ok soon we comunicate
ASKER
soon we comunicate 1-2 days
ASKER
Srinivasbn i need your help i update here the mini project and the database in order to help me is ok is little big is any problem let me know.If You need only samples let me know that sumples You need please
my forms is
Bonus card aplication
Suppliers
Employeees
Products
Ctegories
Orders(sales)
purchase(from employees)
Ncallendar
Nemail
NInfos
NicolaouLogin
and etc
Thnks for help
Regards demoniumz
my forms is
Bonus card aplication
Suppliers
Employeees
Products
Ctegories
Orders(sales)
purchase(from employees)
Ncallendar
Nemail
NInfos
NicolaouLogin
and etc
Thnks for help
Regards demoniumz
How do you save the order? Can you show us the code for saving order. It is a multistep process. When the user adds a product to the order, you need to verify that there is enough quantity in stock to fulfil the order. Then once the order is saved, you need to subtract the quantity sold from the quantity available. And if the remaining quantity is below reorder level then show a message. This all depends on how your form works and how do you do database bits.
ASKER
save the order ok is multistep there are to buttons orders and order details button in order to save it because it save data for 2 table:)
Next When the user adds a product to the order, you need to verify that there is enough quantity in stock to fulfil the order. Then once the order is saved, you need to subtract the quantity sold from the quantity available. And if the remaining quantity is below reorder level then show a message.
Yes Code cruiser you imagine what is my need:) can u help with the code and explain in me a little?
bellow is the save codes
Regards
demoniumz
Next When the user adds a product to the order, you need to verify that there is enough quantity in stock to fulfil the order. Then once the order is saved, you need to subtract the quantity sold from the quantity available. And if the remaining quantity is below reorder level then show a message.
Yes Code cruiser you imagine what is my need:) can u help with the code and explain in me a little?
bellow is the save codes
Regards
demoniumz
Private Sub OrdersBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrdersBindingNavigatorSaveItem.Click
Me.Validate()
Me.OrdersBindingSource.EndEdit()
Me.OrdersTableAdapter.Update(Me.NicolaouDBDataSet.Orders)
End Sub
Private Sub
OrdersDetailsBindingSourceBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrdersBindingNavigatorSaveItem.Click
Me.Validate()
Me.OrdersDetailsBindingSource.EndEdit()
Me.OrdersDetailsTableAdapter.Update(Me.NicolaouDBDataSet.OrdersDetails)
Me.OrdersDetailsDataGridView.Refresh()
TotalSum()
ASKER
hello again to is time to fix these problem code cruiser can u provide any code in order to help me?
ASKER
codecruiserSrinivasbn anyone here?
ASKER
Hello experts i am trying to add a code but is wrong can anyone help me to full fit the requirement i need as above i asked pls>?
Private Sub QuantityTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles QuantityTextBox.KeyDown
If Val(QuantityTextBox.Text) > Val(UnitsInStockTextBox.Text) Then
MsgBox("YOU CROSS THE SALES STOCK LIMIT", 0 + 48, "Nicolaou s Information")
QuantityTextBox.Focus()
Exit Sub
End If
If ReorderLevelTextBox.Text = "" Then
ReorderLevelTextBox.Focus()
Exit Sub
End If
If QuantityTextBox.Text = "" Then
QuantityTextBox.Focus()
Exit Sub
End If
UnitsInStockTextBox.Text = CStr(Val(UnitsInStockTextBox.Text) - CDbl(QuantityTextBox.Text))
End Sub
ASKER
Experts?Is possible to provide me a help in this situation here? I am here to learn not to play.I try a code is now working and i need a second help.I understand that is no time for all but fist be pepoles and after anything else.
Regards demoniumz
Regards demoniumz
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
1) When user presses Add Product button, you first validate the input to make sure that a product is selected and quantity entered among other things
Can u explain in in more details
Can u explain in in more details
ASKER
I may not be able to give you exact code but i can give you seudocode steps.(1) Is really my english languages is not good and i am starter.(2) Thanks for the seudocode steps.I want to ask you if you have any simmilar example to these i want or something general about my problems.
Regards demoniumz
Regards demoniumz
Did you try the Dry Cleaners software example that i provided you in another question?
ASKER
Nop so much i am going to try it again
ASKER
can u give me again the address please again
check it in you questions. on your profile.
ASKER
http://www.functionx.com/vbnet/applications/gcs.htm ok i found it ok thnks
ASKER
i think this is what is needed to do about each thing i add in the datagrid view?My problem is that if i add a word in the quantity textbox is not accepted but the msg box is appear only if add a number i can move somewhere else inside the form why?
Private Sub QuantityTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles QuantityTextBox.Click
Dim quantity As String
Try
quantity = CStr(Me.QuantityTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
ASKER
i think this is what is needed to do about each thing i add in the datagrid view?My problem is that if i add a word in the quantity textbox is not accepted (but the message box is NOT APPEAR) only if add a number i can move somewhere else inside the form why?
Quantity is not expressed in WORDS. It is supposed to be a number so when its not a number, you get the error message. If you mean you are unable to move to somewhere else on form, then look for QuantityTexBox.Focus statement and comment it out.
Change the code to this
Private Sub QuantityTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles QuantityTextBox.Click
Dim quantity As integer
Try
quantity = Integer.parse(Me.QuantityTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
ASKER
working thnks i understand:) codecruiser:)
ASKER
so i must validate all the values that i add in the datagrid view first
Off course. You do not want the user to enter "blablabla" in the quantity textbox do you?
ASKER
check if is ok these validation and apologize sometime i make problem when they problem is not exists:
Private Sub QuantityTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles QuantityTextBox.Click
Dim quantity As Char
Try
quantity = Char.Parse(Me.QuantityTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub ProductNameTextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductNameTextBox1.Click
Dim productname As Integer
Try
productname = Integer.Parse(Me.ProductNameTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub ProductIDComboBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductIDComboBox.Click
Dim productid As Integer
Try
productid = Integer.Parse(Me.ProductIDComboBox.SelectedValue)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub DescriptionTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DescriptionTextBox.Click
Dim Description As Char
Try
Description = Char.Parse(Me.DescriptionTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
End Sub
Private Sub DiscountTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DiscountTextBox.Click
Dim Discount As Integer
Try
Discount = Integer.Parse(Me.DiscountTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub UnitPriceTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UnitPriceTextBox.Click
Dim Unitprice As Integer
Try
Unitprice = Integer.Parse(Me.UnitPriceTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
ASKER
sorry i miss something here is the corected
Private Sub QuantityTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles QuantityTextBox.Click
Dim quantity As Integer
Try
quantity = Integer.Parse(Me.QuantityTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub ProductNameTextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductNameTextBox1.Click
Dim productname As Char
Try
productname = Char.Parse(Me.ProductNameTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub ProductIDComboBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductIDComboBox.Click
Dim productid As Integer
Try
productid = Integer.Parse(Me.ProductIDComboBox.SelectedValue)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub DescriptionTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DescriptionTextBox.Click
Dim Description As Char
Try
Description = Char.Parse(Me.DescriptionTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
End Sub
Private Sub DiscountTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DiscountTextBox.Click
Dim Discount As Integer
Try
Discount = Integer.Parse(Me.DiscountTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Private Sub UnitPriceTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UnitPriceTextBox.Click
Dim Unitprice As Integer
Try
Unitprice = Integer.Parse(Me.UnitPriceTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
End Class
I am sorry mate but it appears to me that i have to teach you each and every thing and i do not have time for that. I suggest you buy some book or look for tutorials on the internet (Google is a developer's best companion).
Problems in code above.
1) Click is not the best event to do this validation.
2) Productname is not validated even if it is then its string not char
...
I wish you good luck on your journey to learning VB.NET.
Problems in code above.
1) Click is not the best event to do this validation.
2) Productname is not validated even if it is then its string not char
...
I wish you good luck on your journey to learning VB.NET.
ASKER
1.which event is the best for validation
2. error parse is not member of string
i know that is not char but string is not accepted codecruiser
2. error parse is not member of string
i know that is not char but string is not accepted codecruiser
Private Sub ProductNameTextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductNameTextBox1.Click
Dim productname As String
Try
productname = String.Parse(Me.ProductNameTextBox.Text)
Catch ex As FormatException
MsgBox("The value you entered is not valid" & _
vbCrLf & "Please try again")
End Try
End Sub
Hi demoniumz,
Due to i am out of station its delayed.
I hope codecruiser gave good suggestion. Here is the some easy code that can perform while entering the values by the user in the text box.
Private Sub QuantityTextBox_KeyPress(B yVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPr essEventAr gs) Handles QuantityTextBox.KeyPress
If (Asc(e.KeyChar) >= 47 And Asc(e.KeyChar) <= 57) Or (Asc(e.KeyChar) = 13) Or (Asc(e.KeyChar) = 8) Then
If Trim(QuantityTextBox.Text) = String.Empty Then
Label1.Text = ""
Exit Sub
End If
If IsNumeric(QuantityTextBox. Text) Then
Label1.Text = "Valid"
Else
Label1.Text = "Not Valid"
End If
Else
e.Handled = True
End If
End Sub
Try this code. Instead of doing parser and catching in Try..Catch blocks it will perform the best for the end user also. It will restrict the end user at the entry level only. So that the user can enter only valid values.
Try this code.
Srinivas.B.N
Due to i am out of station its delayed.
I hope codecruiser gave good suggestion. Here is the some easy code that can perform while entering the values by the user in the text box.
Private Sub QuantityTextBox_KeyPress(B
If (Asc(e.KeyChar) >= 47 And Asc(e.KeyChar) <= 57) Or (Asc(e.KeyChar) = 13) Or (Asc(e.KeyChar) = 8) Then
If Trim(QuantityTextBox.Text)
Label1.Text = ""
Exit Sub
End If
If IsNumeric(QuantityTextBox.
Label1.Text = "Valid"
Else
Label1.Text = "Not Valid"
End If
Else
e.Handled = True
End If
End Sub
Try this code. Instead of doing parser and catching in Try..Catch blocks it will perform the best for the end user also. It will restrict the end user at the entry level only. So that the user can enter only valid values.
Try this code.
Srinivas.B.N
ASKER
4) When saving the order, go through each product in the order and subtract the order quantity from the stock available.
what about these srinivasbn
what about these srinivasbn
i think this is not required. Because you are subtracting the stock directly in the dataset and then you are updating the dataset to the database. So you dont need to check the each order and subtracting the stock.
Srinivas.B.N
Srinivas.B.N
ASKER
where i subtracting the stock directly in the dataset and then you are updating the dataset to the database. ?
ASKER
Srinivas.B.N you mean that?
UnitsInStockTextBox.Text = CStr(Val(UnitsInStockTextB ox.Text) - CDbl(QuantityTextBox.Text) )
UnitsInStockTextBox.Text = CStr(Val(UnitsInStockTextB
Its all depends on your application designed. If you directly binding the dataset to the text box then if you are updating the text box means it will directly updates in the dataset.
Srinivas.B.N
Srinivas.B.N
ASKER
excelent forms is now finish
ASKER