MobiusDick
Hippy Materialist
- Local time
- Today, 07:46
- Joined
- Aug 23, 2007
- Messages
- 23
Hi All,
Having a bit of a nightmare with this bit of code which is intended to ensure that users have selected certain dates before allowing them to proceed and run a section of the app.
The problem is it's just not working- it's assigned to a click button on a form which allows users to select dates, but when you click the button absolutely nothing happens. I'm pretty sure that I've just overlooked something but can;t for the life of me work out what...
any and all suggestions much appreciated.
Having a bit of a nightmare with this bit of code which is intended to ensure that users have selected certain dates before allowing them to proceed and run a section of the app.
The problem is it's just not working- it's assigned to a click button on a form which allows users to select dates, but when you click the button absolutely nothing happens. I'm pretty sure that I've just overlooked something but can;t for the life of me work out what...
any and all suggestions much appreciated.
Code:
Public Sub SubName()
DateDifference = DateDiff("d", [Forms]![frmFormName]![cmbStartDate], [Forms]![frmFormName]![cmbEndDate])
Select Case DateDifference
'''Check to see that the customer base that has been run is 8 days long and nothing else
Case DateDiff("d", [Forms]![frmFormName]![cmbStartDate], [Forms]![frmFormName]![cmbEndDate]) < 7
MsgBox "Please run a customer base that is 8 days long and select the same start and end dates here", vbOKOnly, "Incorrect dates selected"
GreaterThanSeven = MsgBox("Please run a customer base that is 8 days long and select the same start and end dates here", vbOKOnly, "Incorrect dates selected")
Select Case GreaterThanSeven
Case vbOK
DoCmd.Quit acQuitSaveNone
End Select
Case DateDiff("d", [Forms]![frmFormName]![cmbStartDate], [Forms]![frmFormName]![cmbEndDate]) > 7
MsgBox "Please run a customer base that is 8 days long and select the same start and end dates here", vbOKOnly, "Incorrect dates selected"
LessThanSeven = MsgBox("Please run a customer base that is 8 days long and select the same start and end dates here", vbOKOnly, "Incorrect dates selected")
Select Case LessThanSeven
Case vbOK
DoCmd.Quit acQuitSaveNone
End Select
Case DateDiff("d", [Forms]![frmFormName]![cmbStartDate], [Forms]![frmFormName]![cmbEndDate]) = 7
'''Check if an 8 day long customer base has been run in 3rd party app otherwise quit the app
MsgBox "Have you run the latest 8 day customer base in 3rd party app?", vbYesNo, "CHECK 3rd party app"
Reply = MsgBox("Have you run the latest 8 day customer base in 3rd party app?", vbYesNo, "CHECK 3rd party app")
'''If all the above are satisfactory run the queries
Select Case Reply
Case vbYes
Call OtherSubName
Case vbNo
MsgBox "Please run an 8 day long customer base in 3rd party app", vbExclamation, "RUN CUSTOMER BASE"
DoCmd.Quit acQuitSaveNone
End Select
End Select
End Sub