copying between 2 tables

  • Hi ,

    I have problem to copy data from table "Data" to "Data2"

    Both tables have the same structure:

    id AutoNumber

    name text

    datum date/time

    I need to copy rows from Data to Data2

    "WHERE datum > '21.10.2009' "

    I think that there is problem with format of "datum".

    Could you help me with it?

    This is my code written in MS access.

    Dim DB As DAO.Database

    Dim TDF As DAO.TableDef

    Dim SQLstring As String

    Me.K1 = '21.10.2009'

    Set DB = CurrentDb()

    SQLstring = ("INSERT INTO Data2(meno,datum) " & _

    "SELECT meno, datum " & _

    "FROM Data " & _

    "WHERE datum > '" & Me.K1 & "'")

    DB.Execute SQLstring

    DB.Close

    Thanks a lot.

  • Hi, dates in Access are delimited by the # sign: #21.01.2009#

  • Moreover, the only accepted date format in JET SQL is the American date format, whatever the regional settings of the control pannel can be, so: #01/21/2009#

    Have a nice day!

  • Thank you now it works 🙂

    Have a nice day!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply