473,395 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Function not woking first time

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
1 1403
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Lenard Lindstrom | last post by:
I was wondering if anyone has suggested having Python determine a method's kind from its first parameter. 'self' is a de facto reserved word; 'cls' is a good indicator of a class method ( __new__...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
5
by: Tony Johansson | last post by:
Hello experts! Why is not possible to have virtual static members Many thnakn //Tony
5
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char*...
10
by: Nitin | last post by:
Ppl , Want to have ur opinions on having function calls like the one stated below: function funcA ( struct A *st_A , struct B *st_B ) { st_A->a = st_B->a
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
6
by: Rudy | last post by:
Having problems getting the PMT function working. I'm new to programming, and I read the tech notes On how to set up. But it still doesn't work. Can somebody just give me an example the proper way...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
6
by: rep_movsd | last post by:
Hi folks I was on topcoder and came across an interesting problem... It involved dynamic programming ( storing function results in a map to avoid repeated computation ) and I ended up having...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.