dataferret
17th November 2009, 20:55
Hi all
I am using VBA to create tables in MS Access. However I have two problems and I cannot seem to find answers. Hopefully someone here may be able to help.
Problem 1)
I created a table called "counter" using VBA. When I am finished I want to delete the table. My code is identical and works to delete the other tables except for the table name but the counter table refuses to delete.
Code:
' Delete the counter table
Public Function DeleteCounterTable()
CurrentDb.Execute "Drop Table counter;"
End Function
The counter table has the following columns:
startdate, counter
The layout of the table is dictated by another application and cannot be changed. I have no idea why this table will not delete.
Problem 2)
I created a table with fields which require date/time but when I import the date and time values the field shows #Error?
I am using the following code to create the field:
Code:
Set fld = tdf.CreateField("start_date", dbDate)
tdf.Fields.Append fld
The date/time data I am trying to import is:
0001-01-01 00:00:00
MSAccess does not recognise dbDateTime as a valid argument.
I know it is a long shot but I would appreciate any suggestions.
Thanks
I am using VBA to create tables in MS Access. However I have two problems and I cannot seem to find answers. Hopefully someone here may be able to help.
Problem 1)
I created a table called "counter" using VBA. When I am finished I want to delete the table. My code is identical and works to delete the other tables except for the table name but the counter table refuses to delete.
Code:
' Delete the counter table
Public Function DeleteCounterTable()
CurrentDb.Execute "Drop Table counter;"
End Function
The counter table has the following columns:
startdate, counter
The layout of the table is dictated by another application and cannot be changed. I have no idea why this table will not delete.
Problem 2)
I created a table with fields which require date/time but when I import the date and time values the field shows #Error?
I am using the following code to create the field:
Code:
Set fld = tdf.CreateField("start_date", dbDate)
tdf.Fields.Append fld
The date/time data I am trying to import is:
0001-01-01 00:00:00
MSAccess does not recognise dbDateTime as a valid argument.
I know it is a long shot but I would appreciate any suggestions.
Thanks