By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,484 Members | 1,851 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,484 IT Pros & Developers. It's quick & easy.

end if function

P: n/a
i have a form in access that reads the following. i want to add a
function that will not allow the form to be ran if the dates entered in
the dlgdates box have already been ran. essentially i want an "end if"
dates have previously been entered. is there anyone who can help me
with this issue? the code for the current form is:

Private Sub cmdCalcCumBM_Click()
On Error GoTo Err_cmdCalcCumBm_Click

DoCmd.SetWarnings False

CalcCum "qryCalcCumYTDBM"
DoCmd.OpenQuery "qryYTDReturnsBM", acNormal, acEdit
CalcCum "qryCalcCumQBM"
DoCmd.OpenQuery "qryQReturnsBM", acNormal, acEdit
CalcCum "qryCalcCum6mBM"
DoCmd.OpenQuery "qry6MReturnsBM", acNormal, acEdit
CalcCum "qryCalcCum12mBM"
DoCmd.OpenQuery "qry12MReturnsBM", acNormal, acEdit
CalcCum "qryCalcCumCumBM"
DoCmd.OpenQuery "qryCumReturnsBM", acNormal, acEdit
CalcCum "qryCalcCum24mBM"
DoCmd.OpenQuery "qry24MReturnsBM", acNormal, acEdit

MsgBox "All Calculations Completed"

DoCmd.SetWarnings True
Me.Visible = False

Exit_cmdCalcCumBM_Click:
Exit Sub

Err_cmdCalcCumBm_Click:
MsgBox Err.Description
Resume Exit_cmdCalcCumBM_Click
End Sub

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Are the dates in the dialog boxes written to a table somewhere? If so
something like this will work if you put it before at the top of your
function

if not isnull(dlookup("dateField","table","dateField = #"
format(me.DialogBox, "mm/dd/yyyy") & "#")) then
Exit Sub
end if

I know... dlookups are evil etc. but it's quick and dirty and works!

If the dates arent written to a table somewhere then there's no other
way to check if those queries have been run with those dates.

Nov 13 '05 #2

P: n/a
How will you tell whether a date was entered?

What you post, looks like the code for a command button. Essentially,
you would disable the button after use, if it should be run only once.
Conditions for a subsequent run must be formalized, then, otherwise the
button is pretty useless ;-)

Tell me in 'user language' when this button is to be used. This can be
figured out.

js*******@gmail.com wrote:
i have a form in access that reads the following. i want to add a
function that will not allow the form to be ran if the dates entered in
the dlgdates box have already been ran. essentially i want an "end if"
dates have previously been entered. is there anyone who can help me
with this issue? the code for the current form is:

Private Sub cmdCalcCumBM_Click()
On Error GoTo Err_cmdCalcCumBm_Click

DoCmd.SetWarnings False

CalcCum "qryCalcCumYTDBM"
DoCmd.OpenQuery "qryYTDReturnsBM", acNormal, acEdit
CalcCum "qryCalcCumQBM"
DoCmd.OpenQuery "qryQReturnsBM", acNormal, acEdit
CalcCum "qryCalcCum6mBM"
DoCmd.OpenQuery "qry6MReturnsBM", acNormal, acEdit
CalcCum "qryCalcCum12mBM"
DoCmd.OpenQuery "qry12MReturnsBM", acNormal, acEdit
CalcCum "qryCalcCumCumBM"
DoCmd.OpenQuery "qryCumReturnsBM", acNormal, acEdit
CalcCum "qryCalcCum24mBM"
DoCmd.OpenQuery "qry24MReturnsBM", acNormal, acEdit

MsgBox "All Calculations Completed"

DoCmd.SetWarnings True
Me.Visible = False

Exit_cmdCalcCumBM_Click:
Exit Sub

Err_cmdCalcCumBm_Click:
MsgBox Err.Description
Resume Exit_cmdCalcCumBM_Click
End Sub


--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.