Unanswered: Msgbox for null report & update table
Hey all, two problems to tackle.
1) i have this command button to open a report based on the current date. it will show all patient appointments for today's date or any other day whena date is selected (using a date picker). question is, the report that is opening is based on a query and when appointments are scheduled for the current date it works fine. the problem is when an appointment is not scheduled for the current date the report still opens but with blank fields. i would like to implement a msgbox telling the user that 'there are no appointments for that day'. below is the code i'm currently using. i tried using an if statement but i don't know if the syntax for it was correct, because i either got an debug error or it wouldn't register and show the report with the empty fields.
Private Sub cmdGo_Click()
strWhere = "[DateOfAppointment]=#" & FormatDateTime(Me.dtPickDate, vbShortDate) & "#"
'MsgBox "No appointments have been scheduled for the selected date.", vbOKOnly, "No Appointments"
On Error Resume Next
DoCmd.OpenReport "rptCurrentAppointments", acViewPreview, , strWhere
Second question is, i'm doing an inventory type 'thing'. i tried following the Northwind database but that doesn't help. i also tried creating a dbase through the wizard - one of those templates... but that didn't really help me. i used update queries but i got an error about conversion type.
I have a table call tblMedication which has the fields units in stock and units on order. I have created a form for this table called frmMedication and has both those fields in it.
I have a medication order form (frmMedOrders - orderNo, dateOrdered) and a medication order detail subform (subfrmMedOrderDetails - medicationName, quantity, delivered (checkbox), dateDelivered).
I would like to put in the delivered (checkbox) some code that will add the quantity from the subform to the units in stock field in frmMedication, when it is checked.
I also have another form called frmAppointments which contains the medication prescribed. there is no quantity field here because only one type of medication can be sold to one customer per visit. so i would like the units in stock from the frmMedication to also subtract medication every time one is sold to a patient.
i would gladly go again with the update queries, but it's just that error i was getting. any suggestions on any of the questions would be greatly appreciated.
"The extreme always make an impression." - Jeff Hardy