Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Compare Database
- ' /**
- ' * @author Jia Jian
- ' */
- 'variable declarations
- Dim db As DAO.Database
- Dim rs As DAO.Recordset
- ' same as declaring int rsCount; in Java
- Dim rsCount As Integer
- Dim Response, Action
- Public Function checkInventory()
- Set db = CurrentDb
- Set rs = db.OpenRecordset("Low on Stock")
- rsCount = rs.RecordCount
- rs.MoveFirst
- If rsCount > 0 Then
- Response = MsgBox("You have some items/products that are about to run out of stock!" & vbNewLines & "Would you like to see which are the items that are going to run out of stock?", vbYesNo + vbInformation + vbDefaultButton4, "Inventory Check!")
- If Response = vbYes Then
- ' Macro to open the report.
- DoCmd.RunMacro ("Open Low on Stock Report")
- Else
- ' Do nothing
- End If
- Else
- Action = MsgBox("There are no items/products that are low on stock!", vbInformation, "Inventory Check!")
- End If
Add Comment
Please, Sign In to add comment