Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Import, how to tell if date already exists? 1

Status
Not open for further replies.

ChrisCalvert

Technical User
Mar 18, 2002
231
US
I need to be able to check to determine if a date already exist in a table, and if it does not, then import a text file. I have got the import part. I know this is a simple If statement, but I don't really know the best way to go about setting up the test condition. It's something like:

if ( Customers.date contains Date())

This might be a SQL question, ultimately.

Any ideas/help/suggestions/ pills of ultimate Access and SQL knowledge much appreciated. Young Programmer: But, sir, the users are revolting!

Old Programmer: They've always been revolting, now they're just rebellin'!
 
You can simply use DLookup or possibly DMax aggregate functions. They are both documented much better than I could here in the Access help file. DLookup will find and occurence of a specific value in a table, such as a date. DMax could find the latest date in the table, so if you wanted to determine if the system was update past a certain date you would use the DMax function. Just make sure when you are checking for a date field you use the # delimiter.

Samples:
varX = DLookup("[LastName]", "Employees", "[EmployeeID] = 1")

dblReplacementFactor = DMax("[R/F]", "tblComponent_UUT_Link", _
"[CP/N]='" & rst![CP/N] & "' And [Cage]='" & rst!Cage & "'")

Steve King Growth follows a healthy professional curiosity
 
Thanks so much. The Dmax is exactly what I needed.

-Chris Young Programmer: But, sir, the users are revolting!

Old Programmer: They've always been revolting, now they're just rebellin'!
 
Have you also tried creating an unmatch query using the date field. It gives you all records that don't have date already. Then append to exsiting table to import unmatched records.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top