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

Check Date of Table

I am trying to import a paradox table into an access database. I need to do this daily as I get a download of this file everyday. I want to do this on startup of a form.

How can I check the date of the imported table and if it not the current date then update it.

Something like this:

Look at table "balances"
If date of "balances" table in current access db is not today
delete current table "balances"
docmd transferdatabase paradox "balances"
else
do nothing

I think I can write the code to import, it is the date checking that I have no clue where to start.

Thanks in advance.
Sep 5 '07 #1
1 1929
Stwange
126 Expert 100+
This depends (slightly) on how you store the date (which, if you are not doing, you will have to do).
Ideally you have some other table, eg. UPDATE(date, table_name) that you can reference, because otherwise you have to store a field in every record, eg. date_added. If you do the second (or either for that matter, just replace the table and field names in the following line of code), you can use DCOUNT. Now, I've assumed that you do actually want to delete the table here (not just delete the rows from it - quite a difference so if I'm wrong, don't run this code, tell me and I'll modify it).
Expand|Select|Wrap|Line Numbers
  1. IF DCount("*","balances","the_field_with_the_date_stored = #" & date() & "#") = 0 then
  2.     DoCmd.runSQL("DROP TABLE balances;") 'not tested, but double checked on google.
  3.     docmd transferdatabase paradox "balances" 'whatever you want to put here
  4. End If 'No point having an Else do nothing, because without the Else, nothing would have been done.
  5.  
Hope this helps, but it is not tested at all.
Sep 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Notgiven | last post by:
You want to check scheduling conflicts and you have a record like: appointments(table): apptID beginningDate endingDate beginningTime endingTime It's easy enough to check if a time is...
6
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
5
by: starke1120 | last post by:
Im creating a check in – check out database for RF guns. I have a table that contains models. ID (primary key) Model A table that contains Gun Details ID (primary key) Model_id...
3
by: jsurkin | last post by:
I have a form that lists a single work request, with an attached continuous subform that lists specific items that are part of the request. Each item in the subform has a check box to indicate when...
1
by: dande | last post by:
my problem is I have used invoice table, patient table.In Invoice table date,cash,credit, cheque,advance,total is coming.but in patient table having registration type code having gen registraion...
10
by: Cliff72 | last post by:
Is there a way in VBA to check if a linked table in the database has been updated? Example: I have a table "LedgerTemp" which is a direct link to a text file on the LAN "Ledger.txt" This text...
1
balabaster
by: balabaster | last post by:
Hi guys 'n gals, I'm having an issue wrapping my head around a check constraint that I need to set on a table in my database. Table: OnCall Columns: OnCall_PKey (identity), Person_Key,...
82
by: happyse27 | last post by:
Hi All, I modified the user registration script, but not sure how to make it check for each variable in terms of preventing junk registration and invalid characters? Two codes below : a)...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.