Hello,
I am yet again in need of assistance. The goal I am trying to accomplish using VBA within Access 2010 is to append/add certain records to another database (Customer Service) from my database (Client Request). I tried using a macro to append then update records in my database but there is a "lag" time as to when the information is updated in the 'Customer Service' database causing my updates not to occur.
Here is the SQL from my query:
INSERT INTO Issues ( Customer, Title, [Due Date], [Opened By], [Opened Date], Priority, Comments, [Job Number], Description )
SELECT [TBL003_Combined Data].CUSTOMER, [TBL003_Combined Data].TITLE, [TBL003_Combined Data].[DUE DATE], [TBL003_Combined Data].[OPENED BY], [TBL003_Combined Data].[OPENED DATE], [TBL003_Combined Data].PRIORITY, [TBL003_Combined Data].[REF ID], [TBL003_Combined Data].[JOB NUMBER], [TBL003_Combined Data].[ISSUES DESCRIPTION]
FROM [TBL003_Combined Data]
GROUP BY [TBL003_Combined Data].CUSTOMER, [TBL003_Combined Data].TITLE, [TBL003_Combined Data].[DUE DATE], [TBL003_Combined Data].[OPENED BY], [TBL003_Combined Data].[OPENED DATE], [TBL003_Combined Data].PRIORITY, [TBL003_Combined Data].[REF ID], [TBL003_Combined Data].[JOB NUMBER], [TBL003_Combined Data].[ISSUES DESCRIPTION], [TBL003_Combined Data].UPLOADED
HAVING (((Count([TBL003_Combined Data].[REF ID]))>1) AND ((Count([TBL003_Combined Data].PRIORITY))>1));
and here is how I "thought" I could fix it through Access VBA:
Function UpdateIssuesDatabase()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
On Error GoTo UpdateIssuesDatabase_OpenError
con.Open _
"Driver={Microsoft Access Driver (*.mdb, *.accdb)};" & _
"Dbq=\\MACSERV8\Company\Customer Service\Issues FE File\090314\Issues.accdb;" & _
"Exclusive=1;" & _
"Uid=admin;" & _
"Pwd=;"
On Error GoTo 0
With Access.DoCmd
.RunSQL "INSERT INTO Issues ( Customer, Title, [Due Date], [Opened By], [Opened Date], Priority, Comments, [Job Number], Description ) SELECT (CUSTOMER, TITLE, [DUE DATE],[OPENED BY], OPENED DATE], PRIORITY, [REF ID], [JOB NUMBER], [ISSUES DESCRIPTION])FROM [TBL003_Combined Data] WHERE Count([TBL003_Combined Data].[REF ID]))>1) AND ((Count([TBL003_Combined Data].PRIORITY))>1))"
con.Close
Debug.Print "Done."
Exit Function
UpdateIssuesDatabase_OpenError:
Debug.Print "Exclusive 'Open' failed. Quitting."
Exit Function
End With
End Function
I have highlighted where it is giving me the issue. Any assistance of what I need to do will be greatly appreciated.
BLUDEV....DIRE NEED
I am yet again in need of assistance. The goal I am trying to accomplish using VBA within Access 2010 is to append/add certain records to another database (Customer Service) from my database (Client Request). I tried using a macro to append then update records in my database but there is a "lag" time as to when the information is updated in the 'Customer Service' database causing my updates not to occur.
Here is the SQL from my query:
INSERT INTO Issues ( Customer, Title, [Due Date], [Opened By], [Opened Date], Priority, Comments, [Job Number], Description )
SELECT [TBL003_Combined Data].CUSTOMER, [TBL003_Combined Data].TITLE, [TBL003_Combined Data].[DUE DATE], [TBL003_Combined Data].[OPENED BY], [TBL003_Combined Data].[OPENED DATE], [TBL003_Combined Data].PRIORITY, [TBL003_Combined Data].[REF ID], [TBL003_Combined Data].[JOB NUMBER], [TBL003_Combined Data].[ISSUES DESCRIPTION]
FROM [TBL003_Combined Data]
GROUP BY [TBL003_Combined Data].CUSTOMER, [TBL003_Combined Data].TITLE, [TBL003_Combined Data].[DUE DATE], [TBL003_Combined Data].[OPENED BY], [TBL003_Combined Data].[OPENED DATE], [TBL003_Combined Data].PRIORITY, [TBL003_Combined Data].[REF ID], [TBL003_Combined Data].[JOB NUMBER], [TBL003_Combined Data].[ISSUES DESCRIPTION], [TBL003_Combined Data].UPLOADED
HAVING (((Count([TBL003_Combined Data].[REF ID]))>1) AND ((Count([TBL003_Combined Data].PRIORITY))>1));
and here is how I "thought" I could fix it through Access VBA:
Function UpdateIssuesDatabase()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
On Error GoTo UpdateIssuesDatabase_OpenError
con.Open _
"Driver={Microsoft Access Driver (*.mdb, *.accdb)};" & _
"Dbq=\\MACSERV8\Company\Customer Service\Issues FE File\090314\Issues.accdb;" & _
"Exclusive=1;" & _
"Uid=admin;" & _
"Pwd=;"
On Error GoTo 0
With Access.DoCmd
.RunSQL "INSERT INTO Issues ( Customer, Title, [Due Date], [Opened By], [Opened Date], Priority, Comments, [Job Number], Description ) SELECT (CUSTOMER, TITLE, [DUE DATE],[OPENED BY], OPENED DATE], PRIORITY, [REF ID], [JOB NUMBER], [ISSUES DESCRIPTION])FROM [TBL003_Combined Data] WHERE Count([TBL003_Combined Data].[REF ID]))>1) AND ((Count([TBL003_Combined Data].PRIORITY))>1))"
con.Close
Debug.Print "Done."
Exit Function
UpdateIssuesDatabase_OpenError:
Debug.Print "Exclusive 'Open' failed. Quitting."
Exit Function
End With
End Function
I have highlighted where it is giving me the issue. Any assistance of what I need to do will be greatly appreciated.
BLUDEV....DIRE NEED