T
TIML
I am going to have a database open 3 times a day. The only function of this
database is to move data from one database to another. I need to write some
code that opens the connections and then closes them. We used to have a
link to the datasource in access, but it is corrupting the program access is
running when someone has the link open. So I need to run some code to
insert the data into a holding table, so that we can use that table without
any complications.
I tried this:
Sub mytest()
Dim sql As String
sql = "INSERT INTO EMPLOYEES ( [EMPLOYEE ID], [CLOCK NAME], [CLOCK ID],
[FULL NAME], ADDR1, ADDR2, PHONE, SSN, SORT1, SORT2, SORT3, STATUS, CLASS,
[PAYROLL ID], MESSAGE, MSGCODE, FULLTIME, SCHEDULE, OLDSCHEDULE, NEWBADGE,
SwipeAndGo, PicturePath, AccessControl ) IN
'\\george\public\databases\accounting\secure\time.mdb' SELECT
EMPLOYEES.[EMPLOYEE ID], EMPLOYEES.[CLOCK NAME], EMPLOYEES.[CLOCK ID],
EMPLOYEES.[FULL NAME], EMPLOYEES.ADDR1, EMPLOYEES.ADDR2, EMPLOYEES.PHONE,
EMPLOYEES.SSN, EMPLOYEES.SORT1, EMPLOYEES.SORT2, EMPLOYEES.SORT3,
EMPLOYEES.STATUS, EMPLOYEES.CLASS, EMPLOYEES.[PAYROLL ID],
EMPLOYEES.MESSAGE, EMPLOYEES.MSGCODE, EMPLOYEES.FULLTIME,
EMPLOYEES.SCHEDULE, EMPLOYEES.OLDSCHEDULE, EMPLOYEES.NEWBADGE,
EMPLOYEES.SwipeAndGo, EMPLOYEES.PicturePath, EMPLOYEES.AccessControl FROM
EMPLOYEES"
DoCmd.RunSQL sql
End Sub
and it works, but i need the same kind of thing that lets you choose another
database where the FROM EMPLOYEES is.
database is to move data from one database to another. I need to write some
code that opens the connections and then closes them. We used to have a
link to the datasource in access, but it is corrupting the program access is
running when someone has the link open. So I need to run some code to
insert the data into a holding table, so that we can use that table without
any complications.
I tried this:
Sub mytest()
Dim sql As String
sql = "INSERT INTO EMPLOYEES ( [EMPLOYEE ID], [CLOCK NAME], [CLOCK ID],
[FULL NAME], ADDR1, ADDR2, PHONE, SSN, SORT1, SORT2, SORT3, STATUS, CLASS,
[PAYROLL ID], MESSAGE, MSGCODE, FULLTIME, SCHEDULE, OLDSCHEDULE, NEWBADGE,
SwipeAndGo, PicturePath, AccessControl ) IN
'\\george\public\databases\accounting\secure\time.mdb' SELECT
EMPLOYEES.[EMPLOYEE ID], EMPLOYEES.[CLOCK NAME], EMPLOYEES.[CLOCK ID],
EMPLOYEES.[FULL NAME], EMPLOYEES.ADDR1, EMPLOYEES.ADDR2, EMPLOYEES.PHONE,
EMPLOYEES.SSN, EMPLOYEES.SORT1, EMPLOYEES.SORT2, EMPLOYEES.SORT3,
EMPLOYEES.STATUS, EMPLOYEES.CLASS, EMPLOYEES.[PAYROLL ID],
EMPLOYEES.MESSAGE, EMPLOYEES.MSGCODE, EMPLOYEES.FULLTIME,
EMPLOYEES.SCHEDULE, EMPLOYEES.OLDSCHEDULE, EMPLOYEES.NEWBADGE,
EMPLOYEES.SwipeAndGo, EMPLOYEES.PicturePath, EMPLOYEES.AccessControl FROM
EMPLOYEES"
DoCmd.RunSQL sql
End Sub
and it works, but i need the same kind of thing that lets you choose another
database where the FROM EMPLOYEES is.