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

Function not woking first time

P: n/a
Function that works second time
I have a function that works fine, but only the second time.I mean
with the first
click the report is opened blank, and just when i click second time,
the function is triggered and the report is opened properly.I cannot
explain myself why is it so, this is beyond me.
Since the function is working the second time, can i make it work
properly
with the first click ?

Dim strCriteria As String
Dim invoicedate As Control
Dim jan As String
Dim month As Control
Set month = Me![month]
Set invoicedate = Me![invoicedate]
jan = "Month(invoicedate)= 1 and year(invoicedate) = 2004"
Select Case month
Case 1
strCriteria = jan
End Select
Dim strDocName As String
strDocName = "rptMonths"
DoCmd.OpenReport strDocName, acPreview, , strCriteria
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> Select Case month

Perhaps the month variable and field name? Month is a reserved word. You
shouldn't use reserved words as names for your objects or variables. Also,
does month need to be a control or will the value of Me!Month suffice?

--
Wayne Morgan
Microsoft Access MVP
"John" <fr*******@abv.bg> wrote in message
news:f2**************************@posting.google.c om...
Function that works second time
I have a function that works fine, but only the second time.I mean
with the first
click the report is opened blank, and just when i click second time,
the function is triggered and the report is opened properly.I cannot
explain myself why is it so, this is beyond me.
Since the function is working the second time, can i make it work
properly
with the first click ?

Dim strCriteria As String
Dim invoicedate As Control
Dim jan As String
Dim month As Control
Set month = Me![month]
Set invoicedate = Me![invoicedate]
jan = "Month(invoicedate)= 1 and year(invoicedate) = 2004"
Select Case month
Case 1
strCriteria = jan
End Select
Dim strDocName As String
strDocName = "rptMonths"
DoCmd.OpenReport strDocName, acPreview, , strCriteria

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.