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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with empty fields in Access

Status
Not open for further replies.

PhantomMask

Programmer
Nov 21, 2004
1
GB
Hello everyone. I’m hoping the experts here can advise me.

I have been given a MS Access DB file that has a load of data, most of the rows have a LastModified date fields (assigned as “Date/Time”) and the other half of the data does not seem to have any date for this field.

I have been asked to write a SQL query to pull data from within a data range. That’s easy! However, I am unable to perform a search on the empty date field. Please can someone advise me?

Here is the SQL statement I’m using:

[blue]SELECT * FROM myTable WHERE LastModified = ""[/blue]

Or even:

[blue]SELECT * FROM myTable WHERE LastModified = null[/blue]

None seem to work!

Ideally, I would like to have a SQL statement where I can add "01/01/2000 00:00AM" into the empty LastModified fields. Anyone know how to do this? I have set default data in the table schema but it didn’t change the entries for the already existing rows, so perhaps the default data will only work on any newly created rows.

Please can someone advise me?
 
SELECT * FROM myTable WHERE LastModified Is Null

should work

-Pete
 
and i guess ideally you could use

UPDATE myTable SET LastModified = #1/1/2000# WHERE LastModified Is Null;

-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top