473,386 Members | 1,819 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,386 software developers and data experts.

Now()

Hi,

I have some sql in a sub that finds dates in a table but only if the
date is less than today

WHERE [MonthYear] < Now()

I want it to do that but to not include the current month.

For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06

If I run this today (11/01/06) 01/01/06 is included in the result
because it is less than today.
But I dont want the current month included.

Any ideas.

Bob
Jan 10 '06 #1
24 2397
"Bob Wickham" <wi*********@yahoo.com.au> wrote in message
news:43******@dnews.tpgi.com.au...
Hi,

I have some sql in a sub that finds dates in a table but only if the date
is less than today

WHERE [MonthYear] < Now()

I want it to do that but to not include the current month.

For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06

If I run this today (11/01/06) 01/01/06 is included in the result because
it is less than today.
But I dont want the current month included.

Any ideas.

Bob

So you want to include dates less than the first of the current month?

You can use the DateSerial function:

....WHERE MyDate<DateSerial(Year(Date),Month(Date),1)

I'm assuming that your field [MonthYear] is an actual DateTime field
Jan 11 '06 #2
"Bob Wickham" <wi*********@yahoo.com.au> schreef in bericht news:43******@dnews.tpgi.com.au...
Hi,

I have some sql in a sub that finds dates in a table but only if the
date is less than today

WHERE [MonthYear] < Now()

I want it to do that but to not include the current month.

For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06

If I run this today (11/01/06) 01/01/06 is included in the result
because it is less than today.
But I dont want the current month included.

Any ideas.

Bob


So you want to select all dates less than the first day of the current month?

WHERE DateField < DateSerial(Year(Now), Month(Now), 1)

Arno R
Jan 11 '06 #3

"Arno R" <ar***********@tiscali.nl> wrote in message
news:43***********************@text.nova.planet.nl ...
"Bob Wickham" <wi*********@yahoo.com.au> schreef in bericht
news:43******@dnews.tpgi.com.au...
Hi,

I have some sql in a sub that finds dates in a table but only if the
date is less than today

WHERE [MonthYear] < Now()

I want it to do that but to not include the current month.

For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06

If I run this today (11/01/06) 01/01/06 is included in the result
because it is less than today.
But I dont want the current month included.

Any ideas.

Bob


So you want to select all dates less than the first day of the current
month?

WHERE DateField < DateSerial(Year(Now), Month(Now), 1)

Arno R
Hey! Are you copying my answers?
Jan 11 '06 #4
Arno R wrote:
"Bob Wickham" <wi*********@yahoo.com.au> schreef in bericht news:43******@dnews.tpgi.com.au...
Hi,

I have some sql in a sub that finds dates in a table but only if the
date is less than today

WHERE [MonthYear] < Now()

I want it to do that but to not include the current month.

For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06

If I run this today (11/01/06) 01/01/06 is included in the result
because it is less than today.
But I dont want the current month included.

Any ideas.

Bob

So you want to select all dates less than the first day of the current month?

WHERE DateField < DateSerial(Year(Now), Month(Now), 1)

Arno R


Thats it, perfect.

Thankyou to you both.

Bob
Jan 11 '06 #5

"Anthony England" <ae******@oops.co.uk> wrote in message
news:dq**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...

"Arno R" <ar***********@tiscali.nl> wrote in message
news:43***********************@text.nova.planet.nl ...
"Bob Wickham" <wi*********@yahoo.com.au> schreef in bericht
news:43******@dnews.tpgi.com.au...
Hi,

I have some sql in a sub that finds dates in a table but only if the
date is less than today

WHERE [MonthYear] < Now()

I want it to do that but to not include the current month.

For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06

If I run this today (11/01/06) 01/01/06 is included in the result
because it is less than today.
But I dont want the current month included.

Any ideas.

Bob


So you want to select all dates less than the first day of the current
month?

WHERE DateField < DateSerial(Year(Now), Month(Now), 1)

Arno R
Hey! Are you copying my answers?

Based on the time stamps on your posts, it was a dead heat. :-{)
Jan 11 '06 #6
Bob,

Just a quick FYI.

I see that you got your answer and it will take care of the problem I'm
about to mention also. The problem with the original code is that not only
would it have included dates from earlier in the month, it would also have
included dates from the current date. You were comparing to Now() which is
both date and time. If the values you were comparing to this were from the
current day but with an earlier time, they would have been included also. A
date with no time component (i.e. time component is zero) will be treated as
midnight. So any date without a time component that was from the current
date would have been less than Now() unless you happened to catch it just a
midnight.

The reason this happens is because VBA treats dates as a floating point
number. The integer part is the date and the decimal part is the time of
day. The integer portion gives the number of days since 30 Dec 1899 and the
decimal portion give the time as fractions of a day (.0 = midnight, .25 =
6am, .5 = noon, etc). So, a date with no time component would have a decimal
portion of zero (i.e. midnight). If all you want is the date component, I
recommend using the Date() function instead of the Now() function.

--
Wayne Morgan
MS Access MVP
"Bob Wickham" <wi*********@yahoo.com.au> wrote in message
news:43******@dnews.tpgi.com.au...
Hi,

I have some sql in a sub that finds dates in a table but only if the date
is less than today

WHERE [MonthYear] < Now()

I want it to do that but to not include the current month.

For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06

If I run this today (11/01/06) 01/01/06 is included in the result because
it is less than today.
But I dont want the current month included.

Any ideas.

Bob

Jan 11 '06 #7

"Anthony England" <ae******@oops.co.uk> schreef in bericht news:dq**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...

Hey! Are you copying my answers?


Funny this is:
Your Timestamp: Date: Tue, 10 Jan 2006 23:50:50 +0000 (UTC)
My Timestamp: Date: Wed, 11 Jan 2006 00:50:50 +0100
So there is not even a second difference here ...
both almost identical answers ...

Are you *my* evil twin ??
I am looking for one ;-)
Btw:
According to Google this means for both of us:
Local: Wed, Jan 11 2006 12:50 am ??

Arno R
Jan 11 '06 #8
Wayne Morgan wrote:
Bob,

Just a quick FYI.

I see that you got your answer and it will take care of the problem I'm
about to mention also. The problem with the original code is that not only
would it have included dates from earlier in the month, it would also have
included dates from the current date. You were comparing to Now() which is
both date and time. If the values you were comparing to this were from the
current day but with an earlier time, they would have been included also. A
date with no time component (i.e. time component is zero) will be treated as
midnight. So any date without a time component that was from the current
date would have been less than Now() unless you happened to catch it just a
midnight.

The reason this happens is because VBA treats dates as a floating point
number. The integer part is the date and the decimal part is the time of
day. The integer portion gives the number of days since 30 Dec 1899 and the
decimal portion give the time as fractions of a day (.0 = midnight, .25 =
6am, .5 = noon, etc). So, a date with no time component would have a decimal
portion of zero (i.e. midnight). If all you want is the date component, I
recommend using the Date() function instead of the Now() function.


Thanks Wayne,

I understand your advice but, in practise, I can't get it to work.

Should I be able to simply change Now to Date in the solution offered by
Arno and Anthony

WHERE DateField < DateSerial(Year(Now), Month(Now), 1)

like

WHERE DateField < DateSerial(Year(Date), Month(Date), 1)

because doing that results in a "Too few parameters error"

Bob
Jan 11 '06 #9
Bob:

If you're using a European version, I think you need to use ; instead
of , as the parameter separator. (Not 100% sure, though!)
Try WHERE DateField < DateSerial(Year(Date); Month(Date); 1)

HTH,
Jana

Jan 11 '06 #10
Red
I just wanted to note, if you are doing this in a VBA (like in a form,
or in a module), then you need to play with it a bit more....

This is an example of a recent thing I did with dates in a dynamic SQL
statement in a module... it has been modified so I can legally use it
(Darn proprietary agreements...), and so it better fits your
purposes....

'Put this under "Option Explicit"
Global Const JetDateFmt = "\#mm\/dd\/yyyy\#;;;\N\u\l\l"
'This is the 'where' part of your sql
WHERE MyTable.MyDate < Format$(DateSerial(Year(Date()), Month(Date),
1), JetDateFmt)

Jan 11 '06 #11
Jana wrote:
Bob:

If you're using a European version, I think you need to use ; instead
of , as the parameter separator. (Not 100% sure, though!)
Try WHERE DateField < DateSerial(Year(Date); Month(Date); 1)

HTH,
Jana

Thanks Jana, but that results in a Syntax error.

The Now() function works OK but I do like to understand the alternatives.

Bob
Jan 11 '06 #12
Red wrote:
I just wanted to note, if you are doing this in a VBA (like in a form,
or in a module), then you need to play with it a bit more....

This is an example of a recent thing I did with dates in a dynamic SQL
statement in a module... it has been modified so I can legally use it
(Darn proprietary agreements...), and so it better fits your
purposes....

'Put this under "Option Explicit"
Global Const JetDateFmt = "\#mm\/dd\/yyyy\#;;;\N\u\l\l"
'This is the 'where' part of your sql
WHERE MyTable.MyDate < Format$(DateSerial(Year(Date()), Month(Date),
1), JetDateFmt)

Thanks Red,

Yes, it is part of a much larger VBA routine.
I'll give your suggestion a try and see what happens.

Bob
Jan 11 '06 #13
"Red" <do**********@gmail.com> wrote in
news:11**********************@z14g2000cwz.googlegr oups.com:
I just wanted to note, if you are doing this in a VBA (like in a
form, or in a module), then you need to play with it a bit
more....

This is an example of a recent thing I did with dates in a dynamic
SQL statement in a module... it has been modified so I can legally
use it (Darn proprietary agreements...), and so it better fits
your purposes....

'Put this under "Option Explicit"
Global Const JetDateFmt = "\#mm\/dd\/yyyy\#;;;\N\u\l\l"
'This is the 'where' part of your sql
WHERE MyTable.MyDate < Format$(DateSerial(Year(Date()),
Month(Date), 1), JetDateFmt)


That's idiotic.

Format() returns a string, so you're using implicit coercion to
compare the result to a date filed.

Secondly, the US format date will give incorrect results if run on a
machine with different OS-supplied default date formats (e.g.,
DD/MM/YYYY).

DateSerial() returns a value of type variant, but it's always going
to be of a type that compares universally correctly to all stored
data values, independent of local date format settings.

Thus, formatting the output of DateSerial() is undoing the good that
comes from using DateSerial() in the first place.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 11 '06 #14
Bob Wickham <wi*********@yahoo.com.au> wrote in
news:43******@dnews.tpgi.com.au:
I understand your advice but, in practise, I can't get it to work.

Should I be able to simply change Now to Date in the solution
offered by
Arno and Anthony

WHERE DateField < DateSerial(Year(Now), Month(Now), 1)

like

WHERE DateField < DateSerial(Year(Date), Month(Date), 1)

because doing that results in a "Too few parameters error"


Are you sure you're typing:

WHERE DateField < DateSerial(Year(Date()), Month(Date()), 1)

Both Date() and Now() are functions (hence the trailing
parentheses). In VBA code, the () will disappear when you leave the
line, but in SQL, they are necessary.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 11 '06 #15

"Red" <do**********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I just wanted to note, if you are doing this in a VBA (like in a form,
or in a module), then you need to play with it a bit more....

This is an example of a recent thing I did with dates in a dynamic SQL
statement in a module... it has been modified so I can legally use it
(Darn proprietary agreements...), and so it better fits your
purposes....

'Put this under "Option Explicit"
Global Const JetDateFmt = "\#mm\/dd\/yyyy\#;;;\N\u\l\l"
'This is the 'where' part of your sql
WHERE MyTable.MyDate < Format$(DateSerial(Year(Date()), Month(Date),
1), JetDateFmt)


This doesn't make much sense. He's simply comparing 2 dates, there is no
reason to format it. The "correct" code is that suggested by Arno and
Anthony, but using Date rather than Now, as suggested by Wayne.

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Jan 11 '06 #16
David W. Fenton wrote:


Are you sure you're typing:

WHERE DateField < DateSerial(Year(Date()), Month(Date()), 1)

Both Date() and Now() are functions (hence the trailing
parentheses). In VBA code, the () will disappear when you leave the
line, but in SQL, they are necessary.

Hi David,

Well No, I wasn't typing:

" WHERE [MonthYear] < DateSerial(Year(Date()), Month(Date()), 1)" & _

because it was working with

" WHERE [MonthYear] < DateSerial(Year(Now), Month(Now), 1)" & _

so I just replaced the word Now with the word Date.

I have, just now, changed it to read Date() and it works.

Both options work and, with my limited set of data, both options give
the same result.
It IS part of a larger piece of VBA code but the () after Date does not
disappear.

Bob
Jan 12 '06 #17
"Bob Wickham" <wi*********@yahoo.com.au> wrote in message
news:43******@dnews.tpgi.com.au...
David W. Fenton wrote:
>


Are you sure you're typing:

WHERE DateField < DateSerial(Year(Date()), Month(Date()), 1)

Both Date() and Now() are functions (hence the trailing
parentheses). In VBA code, the () will disappear when you leave the
line, but in SQL, they are necessary.

Hi David,

Well No, I wasn't typing:

" WHERE [MonthYear] < DateSerial(Year(Date()), Month(Date()), 1)" & _

because it was working with

" WHERE [MonthYear] < DateSerial(Year(Now), Month(Now), 1)" & _

so I just replaced the word Now with the word Date.

I have, just now, changed it to read Date() and it works.

Both options work and, with my limited set of data, both options give the
same result.
It IS part of a larger piece of VBA code but the () after Date does not
disappear.

Bob

David has correctly pointed out an oversight on my part: You do need the
brackets if this is part of an sql string. It is a bit of quirk that when
you use the vba editor the brackets are removed but this does not obviously
apply when they are part of a string.

In other words, you write:

strSQL="SELECT Orders.* FROM Orders WHERE Orders.OrderDate<Date()"

and you must use the brackets. However, if you try to write the following:

Private Sub cmdTest_Click()
Dim dte As Date
Dim str As String
dte = Date()
str = Format(dte, "dd-mmm-yy")
MsgBox str
End Sub

You will find that the line
dte = Date()
is changed to
dte = Date

Hope that is clear.
As to the difference between Date() and Now() you need to realise that
DateTime fields store both a time and date portion in one field.
So if I was writing this at 8 am on 12 Jan,
<Now() means any date/time less than 8 am on 12 Jan
<Date() means date/time less than when the date changes (at midnight)
In other words <Now() would include a record dated 12-Jan @ 5:30 am whereas
<Date() would not.

However, in your example, we are using theDateSerial function so both
functions:
DateSerial(Year(Now()), Month(Now()), 1)
DateSerial(Year(Date()), Month(Date()), 1)
return exactly the same result: 1 Jan 2006 @ 00:00
Jan 12 '06 #18

"Bob Wickham" <wi*********@yahoo.com.au> wrote in message
news:43******@dnews.tpgi.com.au...
David W. Fenton wrote:
>


Are you sure you're typing:

WHERE DateField < DateSerial(Year(Date()), Month(Date()), 1)

Both Date() and Now() are functions (hence the trailing
parentheses). In VBA code, the () will disappear when you leave the
line, but in SQL, they are necessary.

Hi David,

Well No, I wasn't typing:

" WHERE [MonthYear] < DateSerial(Year(Date()), Month(Date()), 1)" & _

because it was working with

" WHERE [MonthYear] < DateSerial(Year(Now), Month(Now), 1)" & _

so I just replaced the word Now with the word Date.

I have, just now, changed it to read Date() and it works.

Both options work and, with my limited set of data, both options give the
same result.
It IS part of a larger piece of VBA code but the () after Date does not
disappear.

Bob

David has correctly pointed out an oversight on my part: You do need the
brackets if this is part of an sql string. It is a bit of quirk that when
you use the vba editor the brackets are removed but this does not obviously
apply when they are part of a string.

In other words, you write:

strSQL="SELECT Orders.* FROM Orders WHERE Orders.OrderDate<Date()"

and you must use the brackets. However, if you try to write the following:

Private Sub cmdTest_Click()
Dim dte As Date
Dim str As String
dte = Date()
str = Format(dte, "dd-mmm-yy")
MsgBox str
End Sub

You will find that the line
dte = Date()
is changed to
dte = Date

Hope that is clear.
As to the difference between Date() and Now() you need to realise that
DateTime fields store both a time and date portion in one field.
So if I was writing this at 8 am on 12 Jan,
<Now() means any date/time less than 8 am on 12 Jan
<Date() means date/time less than when the date changes (at midnight)
In other words <Now() would include a record dated 12-Jan @ 5:30 am whereas
<Date() would not.

However, in your example, we are using theDateSerial function so both
functions:
DateSerial(Year(Now()), Month(Now()), 1)
DateSerial(Year(Date()), Month(Date()), 1)
return exactly the same result: 1 Jan 2006 @ 00:00
Jan 12 '06 #19
Thanks Anthony,
Brilliant explanation which has certainly made things a lot clearer for me.

Thankyou

Bob Wickham
Jan 12 '06 #20
Bob,

If VBA gets rid of the () after Now but not after Date (it should after
both) then I would suspect that you're using the word Date for something
else also, possibly a field name. Since this is a function name, it is a
reserved word and can cause you problems if you use it for other things. By
keeping the () after Date, VBA is distinguishing this as the function as
opposed to the other use of the word Date.

--
Wayne Morgan
MS Access MVP
"Bob Wickham" <wi*********@yahoo.com.au> wrote in message
news:43******@dnews.tpgi.com.au...
David W. Fenton wrote:
>


Are you sure you're typing:

WHERE DateField < DateSerial(Year(Date()), Month(Date()), 1)

Both Date() and Now() are functions (hence the trailing
parentheses). In VBA code, the () will disappear when you leave the
line, but in SQL, they are necessary.

Hi David,

Well No, I wasn't typing:

" WHERE [MonthYear] < DateSerial(Year(Date()), Month(Date()), 1)" & _

because it was working with

" WHERE [MonthYear] < DateSerial(Year(Now), Month(Now), 1)" & _

so I just replaced the word Now with the word Date.

I have, just now, changed it to read Date() and it works.

Both options work and, with my limited set of data, both options give the
same result.
It IS part of a larger piece of VBA code but the () after Date does not
disappear.

Bob

Jan 12 '06 #21
Wayne Morgan wrote:
Bob,

If VBA gets rid of the () after Now but not after Date (it should after
both) then I would suspect that you're using the word Date for something
else also, possibly a field name. Since this is a function name, it is a
reserved word and can cause you problems if you use it for other things. By
keeping the () after Date, VBA is distinguishing this as the function as
opposed to the other use of the word Date.

Hello Wayne,

Yes, I agree, its strange behaviour, but I have checked all my tables
and code and can't find the word Date anywhere. I've used words like
TheDate or PaymentDate or tblDate.

The code with the offending Date() is reproduced below.

Private Sub Command2_Click()

Dim dbs As Database
Dim rstLoans As DAO.Recordset
Dim rstMissed As DAO.Recordset
Dim strSql As String

Set dbs = CurrentDb

' call the function DeleteAll()

Call DeleteAll("tblMissingCommissionReport")

Set rstLoans = dbs.OpenRecordset("SELECT DISTINCT LoanNo FROM
tblCommission")

Do Until rstLoans.EOF
Set rstMissed = dbs.OpenRecordset("SELECT [MonthYear]" & _
" FROM tblDate" & _
" WHERE [MonthYear] < DateSerial(Year(Date()),
Month(Date()), 1)" & _
" AND Format([MonthYear],'mmmm,yyyy')" & _
" Not In (SELECT Format ([PaymentDate],'mmmm,yyyy')" & _
" FROM tblCommission" & _
" WHERE LoanNo =" & rstLoans!LoanNo & ")")

Do Until rstMissed.EOF
strSql = "INSERT INTO tblMissingCommissionReport (
LoanNumber, TheDate )" & _
" VALUES ( " & rstLoans!LoanNo & ", " &
CLng(rstMissed!MonthYear) & " )"
dbs.Execute strSql, dbFailOnError
rstMissed.MoveNext
Loop
rstMissed.Close
rstLoans.MoveNext
Loop
rstLoans.Close
Set rstMissed = Nothing
Set rstLoans = Nothing
Set dbs = Nothing

' call the sub RunMcrMissingCommissionReportPrintPreview()

Call RunMcrMissingCommissionReportPrintPreview
End Sub
Jan 12 '06 #22
This is a long thread. I have not read it so I may be saying something
that has already been said. If so, I apologise.
When there is confusion about the VBA function Date() and some other
Date, one can clear up the confusion by using VBA.Date(). TTBOMK this
is not shortened to VBA.Date, nor is it confused with the little blonde
number in 1104 on the next floor.
When I remember I use VBA.Date() instead of Date, just to be sure there
is no confusion.

Jan 12 '06 #23
Bob Wickham <wi*********@yahoo.com.au> wrote in
news:43******@dnews.tpgi.com.au:
The code with the offending Date() is reproduced below.


You're confusing a string with code. In your example, Date() occurs
only in a string, so it's really quite irrelevant.

The real question is who "Now" without () ever works in SQL.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 12 '06 #24
You have Date() within the SQL string you are using to open the recordset. A
string will be taken "as is" by VBA. It doesn't do any editing on it except
for doubled up delimiters (quotes) being changes to single delimiters after
the assignment of the string. SQL usually wants the () on the function, so
what you have is now correct and explains why it didn't work without the ().
VBA is NOT processing the Date() function. However, VBA would process the
Date() function in a statement such as

dteMyDate = Date

In this case, it would drop the () if you typed them in.

--
Wayne Morgan
MS Access MVP
"Bob Wickham" <wi*********@yahoo.com.au> wrote in message
news:43******@dnews.tpgi.com.au...
Wayne Morgan wrote:
Bob,

If VBA gets rid of the () after Now but not after Date (it should after
both) then I would suspect that you're using the word Date for something
else also, possibly a field name. Since this is a function name, it is a
reserved word and can cause you problems if you use it for other things.
By keeping the () after Date, VBA is distinguishing this as the function
as opposed to the other use of the word Date.

Hello Wayne,

Yes, I agree, its strange behaviour, but I have checked all my tables and
code and can't find the word Date anywhere. I've used words like TheDate
or PaymentDate or tblDate.

The code with the offending Date() is reproduced below.

Private Sub Command2_Click()

Dim dbs As Database
Dim rstLoans As DAO.Recordset
Dim rstMissed As DAO.Recordset
Dim strSql As String

Set dbs = CurrentDb

' call the function DeleteAll()

Call DeleteAll("tblMissingCommissionReport")

Set rstLoans = dbs.OpenRecordset("SELECT DISTINCT LoanNo FROM
tblCommission")

Do Until rstLoans.EOF
Set rstMissed = dbs.OpenRecordset("SELECT [MonthYear]" & _
" FROM tblDate" & _
" WHERE [MonthYear] < DateSerial(Year(Date()),
Month(Date()), 1)" & _
" AND Format([MonthYear],'mmmm,yyyy')" & _
" Not In (SELECT Format ([PaymentDate],'mmmm,yyyy')" &
_
" FROM tblCommission" & _
" WHERE LoanNo =" & rstLoans!LoanNo & ")")

Do Until rstMissed.EOF
strSql = "INSERT INTO tblMissingCommissionReport ( LoanNumber,
TheDate )" & _
" VALUES ( " & rstLoans!LoanNo & ", " &
CLng(rstMissed!MonthYear) & " )"
dbs.Execute strSql, dbFailOnError
rstMissed.MoveNext
Loop
rstMissed.Close
rstLoans.MoveNext
Loop
rstLoans.Close
Set rstMissed = Nothing
Set rstLoans = Nothing
Set dbs = Nothing

' call the sub RunMcrMissingCommissionReportPrintPreview()

Call RunMcrMissingCommissionReportPrintPreview
End Sub

Jan 12 '06 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jeffrey Melloy | last post by:
I was recently running into performance problems with a query containing now()::date or CURRENT_DATE. When I went to debug, 'now'::date made efficient use of the index (on a timestamp field). ...
21
by: Willie jan | last post by:
place this behind a button that fills a listbox. as you will see the time is now and then 0 or filled in???????????? by hitting the button. is there a way to determine the real elapsed time? ...
24
by: Rob R. Ainscough | last post by:
VS 2005 I have: ClickOnce deployment User's that hate and or don't want to use an IE Client (don't blame them) I don't see how ASPX web pages are going to survive? With .NET 2.0 and clickonce...
2
by: archana | last post by:
Hi all, I am facing some wired problem while using above mention data type. What i am doing is i am writing DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" +...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.