how to diplay an error massege

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aBheE
    New Member
    • Dec 2009
    • 6

    how to diplay an error massege

    i have a table called main which allows the user to enter values and they will be stored in the table named main. this contains data of all the items the user has issued to the company. and this will update the qty on column of the products table aswell. on the products table there s another column called ReOrderLevel, which is defined by me and which contains the qty which if goes below the level the user shud order that particular product.

    and now what i want to do is when the user updates the form 'main' to get the re order level and compare it with qty on hand and then if qty on hand is below the re order level, to display a msg in order to inform the user that he is running out on stock on particular products

    i have made a query and got the report to display all the products which has the quantity below the re order level. and i have an update query to update the quanity on hand when an product is issued using the form 'main'

    what i want to kno is to which control shud i apply the code? will i have to make a new form? do i have 2 make changes to my database?
    my db is attatched below

    it will be great if i cud get an answer soon.
    thanx
    Attached Files
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by aBheE
    i have a table called main which allows the user to enter values and they will be stored in the table named main. this contains data of all the items the user has issued to the company. and this will update the qty on column of the products table aswell. on the products table there s another column called ReOrderLevel, which is defined by me and which contains the qty which if goes below the level the user shud order that particular product.

    and now what i want to do is when the user updates the form 'main' to get the re order level and compare it with qty on hand and then if qty on hand is below the re order level, to display a msg in order to inform the user that he is running out on stock on particular products

    i have made a query and got the report to display all the products which has the quantity below the re order level. and i have an update query to update the quanity on hand when an product is issued using the form 'main'

    what i want to kno is to which control shud i apply the code? will i have to make a new form? do i have 2 make changes to my database?
    my db is attatched below

    it will be great if i cud get an answer soon.
    thanx
    You could place the following code in the Click() Event of the Done Command Button. I'm assuming that all Fields have Values contained within, so I'll leave Validation to you.
    Code:
    Dim intReorderLevel As Integer
    
    intReorderLevel = DLookup("[ReorderLevel]", "Products", "[P_Name] = '" & Me![Combo0] & "'")
    
    'If the Stock on Hand + the Quantity being Added > the Reorder Level
    If (CInt(Combo0.Column(2)) + CInt(Nz(Me![Text7], 0))) > intReorderLevel Then
      MsgBox "Time to Reorder " & Me![Combo0], vbCritical, "Reorder Product"
    End If
    
    DoCmd.Close

    Comment

    Working...