Help with code please

S

steve goodrich

John,
The code below worked ok - it returned two records which is all I have in my
database
The other 3 examples displayed the following error
Run time error 64479, can't find the name Monthly_date you entered in your
expression

Steve
 
J

John W. Vinson

Run time error 64479, can't find the name Monthly_date you entered in your
expression

Does your table contain a field named Monthly_date (with the underscore)?

If it contains a field named "Monthly date", replace Monthly_date with
[Monthly date] including the square brackets.
 
S

steve goodrich

John,
Amended the code and the following results wre produced

?DCOUNT("*","tblmonthly","[Monthly Date] < Date()-30")
1

?DCOUNT("*","tblmonthly","[Monthly Date] Between Date()-30 and Date()")
1
?DCount("[Monthly Date]","tblmonthly")
2

?DCount("*","tblmonthly")
2

There are only 2 records in my db - dates are:
25 June 09 & 27 July 09

Steve

John W. Vinson said:
Run time error 64479, can't find the name Monthly_date you entered in your
expression

Does your table contain a field named Monthly_date (with the underscore)?

If it contains a field named "Monthly date", replace Monthly_date with
[Monthly date] including the square brackets.
 
J

John Spencer

Good, then it seems as if you need to use the test with the correct field
name and hopefully you will get the results you are looking for.

IF DCOUNT("[Monthly Date]","tblmonthly","[Monthly Date] Between Date()-30 and
Date()") = 0 THEN
MsgBox "Test overdue,please schedule asap", vbCritical, "Monthly Checks"
End If

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

steve said:
John,
Amended the code and the following results wre produced

?DCOUNT("*","tblmonthly","[Monthly Date] < Date()-30")
1

?DCOUNT("*","tblmonthly","[Monthly Date] Between Date()-30 and Date()")
1
?DCount("[Monthly Date]","tblmonthly")
2

?DCount("*","tblmonthly")
2

There are only 2 records in my db - dates are:
25 June 09 & 27 July 09

Steve

John W. Vinson said:
Run time error 64479, can't find the name Monthly_date you entered in your
expression
Does your table contain a field named Monthly_date (with the underscore)?

If it contains a field named "Monthly date", replace Monthly_date with
[Monthly date] including the square brackets.
 
S

steve goodrich

John,

Yes, that did the trick - works perfectly.
Many thanks for your time and patience.

I have just bought a copy of Access 97 Programming for dummies (We use 97 at
work) to try to understand VBA
Could you recommend any web sites for absolute beginners that have a basic
understanding of Access but are totally clueless when it comes to code!!

John Spencer said:
Good, then it seems as if you need to use the test with the correct field
name and hopefully you will get the results you are looking for.

IF DCOUNT("[Monthly Date]","tblmonthly","[Monthly Date] Between Date()-30
and Date()") = 0 THEN
MsgBox "Test overdue,please schedule asap", vbCritical, "Monthly
Checks"
End If

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

steve said:
John,
Amended the code and the following results wre produced

?DCOUNT("*","tblmonthly","[Monthly Date] < Date()-30")
1

?DCOUNT("*","tblmonthly","[Monthly Date] Between Date()-30 and Date()")
1
?DCount("[Monthly Date]","tblmonthly")
2

?DCount("*","tblmonthly")
2

There are only 2 records in my db - dates are:
25 June 09 & 27 July 09

Steve

John W. Vinson said:
On Mon, 3 Aug 2009 22:24:30 +0100, "steve goodrich"

Run time error 64479, can't find the name Monthly_date you entered in
your
expression
Does your table contain a field named Monthly_date (with the
underscore)?

If it contains a field named "Monthly date", replace Monthly_date with
[Monthly date] including the square brackets.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top