Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access External data > DCount problem....
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 10878 of 11313
Post > Topic >>

DCount problem...

by =?Utf-8?B?Sm9obg==?= <John@[EMAIL PROTECTED] > Aug 2, 2008 at 10:09 PM

I am im****ting a spreadsheet into a table in my database, however I need to

check the data that's in the table prior to im****ting the spreadsheet.  I 
can't seem to get the DCount function to work for me.  Can anyone spot
what 
my problem may be?  Here's the code:

'Check to see if this monthly is already in the tblMonthly table.
Set db = CurrentDb 'Do I even need this?
RptDte = DateValue(Right(Trim(strThrDte), 8))  '(strThrDte is a long
string. 
 The date is in the last char of the string in MM/DD/YY format.
rsCnt = 0
rsCnt = DCount("[fnDte]", "tblMonthly", "Month([tblMonthly]![fnDte]) = 
Month(" & RptDte & ") And Year([tblMonthly]![fnDte]) = Year(" & RptDte &
")")
'if the record set count is over zero, the month / year combination is 
already in the table.  If it's greater than 0, data is already there so
don't 
im****t.

If rsCnt = 0 Then
    'This data does not exist in the tblMonthly table.
Else
    'This monthly already is in the tblMonthly table.
    MsgBox "There is alredy a monthly re****t in Project Cost History for "
& 
Format(RptDte, "MMM-YY") & ". Delete the old monthly before im****ting a
new 
one.", vbOKOnly, "Monthly exsists already..."
    Exit Sub
End If

I have to check the month and year rather than just the date, because the 
exact day is not known.

-- 
Thanks - John
 




 3 Posts in Topic:
DCount problem...
=?Utf-8?B?Sm9obg==?= <  2008-08-02 22:09:00 
Re: DCount problem...
"Chris O'C via Acces  2008-08-03 05:45:17 
Re: DCount problem...
=?Utf-8?B?Sm9obg==?= <  2008-08-03 20:35:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 18:45:07 CST 2008.