UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Executing A Module On Form Load?    
 
   
JV63
post Jan 16 2017, 01:39 PM
Post#21



Posts: 183
Joined: 16-August 12



By putting that into the immediate window I get the reserved error popup (run time 2950).
Go to the top of the page
 
theDBguy
post Jan 16 2017, 03:12 PM
Post#22


Access Wiki and Forums Moderator
Posts: 71,196
Joined: 19-June 07
From: SunnySandyEggo


Okay, so now, you'll just need to figure out a different method or approach to check if the code should run or not other than the way you're attempting to now. For example, do you even get an error with the following?

?DCount("*", "tblBackupDetails", "BackupDate=Date")

If so, can you please post all the field names in tblBackupDetails? Thanks.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
JV63
post Jan 16 2017, 03:28 PM
Post#23



Posts: 183
Joined: 16-August 12



I do get an reserved error with that immediate code also.

My backup table fields are:

ComputerName - Short Text
BackupDate - Date/Time
BackupFolder - Short Text
Filename - Short Text
Go to the top of the page
 
theDBguy
post Jan 16 2017, 03:44 PM
Post#24


Access Wiki and Forums Moderator
Posts: 71,196
Joined: 19-June 07
From: SunnySandyEggo


Okay thanks. I don't see any reserved words in the names you used for your fields. Do you get an error with this?

?DCount("*", "tblBackupDetails")

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
JV63
post Jan 16 2017, 03:49 PM
Post#25



Posts: 183
Joined: 16-August 12



Yes, reserved error as well.
Go to the top of the page
 
theDBguy
post Jan 16 2017, 04:11 PM
Post#26


Access Wiki and Forums Moderator
Posts: 71,196
Joined: 19-June 07
From: SunnySandyEggo


Hi,

See if you can safely use DCount() against other tables without error. If so, then you might have to look more closely at the data in the problem table. Otherwise, check if you have any missing references preventing DCount() to work properly.

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
JV63
post Jan 16 2017, 04:13 PM
Post#27



Posts: 183
Joined: 16-August 12



Ok, ,will take a look. the backup table is empty at the moment since it's a new module that's supposed to right to it but could have missing references for Dcount. Good suggestions.
Go to the top of the page
 
theDBguy
post Jan 16 2017, 04:23 PM
Post#28


Access Wiki and Forums Moderator
Posts: 71,196
Joined: 19-June 07
From: SunnySandyEggo


Even if the table is empty, DCount("*","TableName") should return a 0. So, if you can't use DCount() on other tables, then DCount() is having a problem on your database. One common cause is a missing reference.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
JV63
post Jan 16 2017, 04:25 PM
Post#29



Posts: 183
Joined: 16-August 12



By commenting out the whole Dcount I got it to create a backup database. However I don't see any entry in my tblBackupDetails table.

If DCount("BackupDate", "tblBackupDetails", "BackupDate = date()") <> 0 Then
Exit Function
End If

So got closer to doing what I wanted but don't know what not having Dcount not work will do as the intent is to only create a backup once a day. I'm thinking Dcount has something to do with that.
Go to the top of the page
 
theDBguy
post Jan 16 2017, 04:27 PM
Post#30


Access Wiki and Forums Moderator
Posts: 71,196
Joined: 19-June 07
From: SunnySandyEggo


Well, first, we'll need to make sure DCount() is working on your system. So, I would suggest trying it against a different table. As for its use in your function, it's merely checking if a backup was already created today. There is nothing I can see in the code you posted where you add a record to the table when a backup is created on a new day.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
JV63
post Jan 16 2017, 04:38 PM
Post#31



Posts: 183
Joined: 16-August 12



Yeah, something is up with Dcount cause I'm getting errors against other tables too.
Go to the top of the page
 
theDBguy
post Jan 16 2017, 05:29 PM
Post#32


Access Wiki and Forums Moderator
Posts: 71,196
Joined: 19-June 07
From: SunnySandyEggo


Were you missing any references?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
JV63
post Jan 16 2017, 05:41 PM
Post#33



Posts: 183
Joined: 16-August 12



Not that I'm aware of. I'll have to look deeper but it's the same code I've used for other access databases and the backup module works perfectly in both backing up the back-end database and making entries in the tbl.
Go to the top of the page
 
theDBguy
post Jan 16 2017, 07:16 PM
Post#34


Access Wiki and Forums Moderator
Posts: 71,196
Joined: 19-June 07
From: SunnySandyEggo


Hi,

If you get stuck, please consider posting a small copy of your DB, so we can give you a hand. Good luck.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
2 Pages V < 1 2


Custom Search
RSSSearch   Top   Lo-Fi    10th December 2017 - 11:12 PM