Low on inc pop-up warning on every

T

Toolz2life

I am doing a Printer inventory and have two columns, type of cartridge and
the quantity. What I would like to do is when the quantity of each cartridge
goes below 3 when exiting, every time, a pop up warning “Inc is low for
cartridge X. Order more “shows up. So far I have it giving a pop up that
tells when the quantity is low, but want I really want it to do is tell the
type of cartridge that is low at every exit. Can this be done? What would
the coding look like? this what I have now

Private Sub Quantity_AfterUpdate()
If Me.Quantity <= 3 Then
MsgBox "Printer Inc is low. Order more Inc!"
End If

End Sub

This only give me the pop up after up date, but does not tell which
cartridge is low. I am trying to have the code tell me each cartride that is
low at evary exit

This is the info, so if HP -10 go under 3 in the inventory a pop up will say
"HP-10 Inc is low. Order more Inc" and it will give the pop -up every time at
exit until the inventory is incressed over 3.
Type of Cartridge Quantity
HP - 10 2
HP - 15 6
Can anyone show me how to get this done?

Thanks

Toolz
 
T

Toolz2life

ok! that did tell what cartfride is low, but can i have it tell me all the
cartridge that are low on every exit. Right now it will tell you if the
cartridge is low is you have just reduce it then when exiting will tell you
cartridge is low. Can I have it do that wil out and up date at the exit.
 
S

Steve Schapel

Toolz,

You mean if there are multiple cartridges in your database which are
"low", and you want the message box to include all of them? Hmmm, well
that is theoretically possible, but I would suggest that a MsgBox is not
really the appropriate approach with this. I would try it like this
instead...
Make a query based on your table, with a Criteria <4 in the Quantity field.
Make a continuous view Form based on this query.
On the After Update event of the existing form (not the Quantity
control), put code like this...
Private Sub Form_AfterUpdate()
If DCount("*","YourQuery") > 0 Then
DoCmd.OpenForm "Your New Form"
End If
End Sub

For the record, to do it with the MsgBox idea, the code would be
something like this...
Private Sub Quantity_Exit(Cancel As Integer)
Dim rst as DAO.Recordset
Dim MessageText As String
Me.Dirty = False
Set rst = CurrentDb.OpenRecordset("SELECT [Type of Cartridge] FROM
YourTable WHERE Quantity < 4")
Do Until rst.EOF
MessageText = MessageText & rst![Type of Cartridge] & vbCrLf
rst.MoveNext
Loop
rst.Close
If Len(MessageText) Then
MsgBox "Ink is low:" & vbCrLf & MessageText
End If
Set rst = Nothing
End Sub
 
T

Toolz2life

Steve,
Thank for the for the info. I am trying it with the Msbox and I am putting
the code in and when i run the program i am getting a syntax error at the
point "("SELECT [Type of Cartridge] FROM YourTable WHERE Quantity < 4")".
Where you put "FROM YourTable WHERE Quantity" I delet that and put the name
of the table by it self, which is Quantity. I know a little code-in but not
enough to know what i am doing wrong.

Thank,

Toolz

Steve Schapel said:
Toolz,

You mean if there are multiple cartridges in your database which are
"low", and you want the message box to include all of them? Hmmm, well
that is theoretically possible, but I would suggest that a MsgBox is not
really the appropriate approach with this. I would try it like this
instead...
Make a query based on your table, with a Criteria <4 in the Quantity field.
Make a continuous view Form based on this query.
On the After Update event of the existing form (not the Quantity
control), put code like this...
Private Sub Form_AfterUpdate()
If DCount("*","YourQuery") > 0 Then
DoCmd.OpenForm "Your New Form"
End If
End Sub

For the record, to do it with the MsgBox idea, the code would be
something like this...
Private Sub Quantity_Exit(Cancel As Integer)
Dim rst as DAO.Recordset
Dim MessageText As String
Me.Dirty = False
Set rst = CurrentDb.OpenRecordset("SELECT [Type of Cartridge] FROM
YourTable WHERE Quantity < 4")
Do Until rst.EOF
MessageText = MessageText & rst![Type of Cartridge] & vbCrLf
rst.MoveNext
Loop
rst.Close
If Len(MessageText) Then
MsgBox "Ink is low:" & vbCrLf & MessageText
End If
Set rst = Nothing
End Sub

--
Steve Schapel, Microsoft Access MVP
ok! that did tell what cartfride is low, but can i have it tell me all the
cartridge that are low on every exit. Right now it will tell you if the
cartridge is low is you have just reduce it then when exiting will tell you
cartridge is low. Can I have it do that wil out and up date at the exit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top