Advertisement

03.19.2008 at 10:24PM PDT, ID: 23256030 | Points: 125
[x]
Attachment Details

Updating Accpac tables using Accpac views

Asked by accpacnet in Microsoft Access Database, ERP Software

Tags: , ,

I am trying to use views to create a stand-alone application in Microsoft Access that can update our Accpac database.

Presently, I am stuck with some VBA code that I have written to load the data present in an existing Access database into an Accpac company that we have created. I have successfully used the PMCONTS and PMPROJ views to create the necessary contract and project records. I am now struggling to use the PMPROJS view. One issue that I have faced right since the beginning is figuring out what information must be provided to insert data into Accpac through the view and what information should be left out. Plus, when the code doesnt go through, I only get a generic error message, which reads like: view call failed. I am in dire need of some tools to make this process more efficient. I am not sure what tools I need (a special development environment, for example) and where I can get them.

I would like to know where the best resources for this kind of effort are and how I can deal with my current problem of using the PMPROJS view. Your help will be greatly appreciated.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
Option Compare Database 
 
Private Sub Form_Load() 
Dim fld As ADODB.Field, i As Integer 
 
Dim session As New ACCPACXAPILib.xapiSession 
session.Open "ADMIN", "ADMIN", "CPCCIL", Date, 0 
 
Dim PMPROJS As ACCPACXAPILib.xapiView 
Set PMPROJS = session.OpenView("PM0022", "PM") 
 
Dim rst_AUTHORIZATION As ADODB.Recordset 
Set rst_AUTHORIZATION = New ADODB.Recordset 
rst_AUTHORIZATION.Open "SELECT * FROM qry_ACTIVE_AUTHORIZATIONS", CurrentProject.Connection, _ 
adOpenDynamic, adLockPessimistic 
 
Dim rst_PMPROJS_TEMPLATE As ADODB.Recordset 
Set rst_PMPROJS_TEMPLATE = New ADODB.Recordset 
rst_PMPROJS_TEMPLATE.Open "tbl_PMPROJS_TEMPLATE", CurrentProject.Connection 
 
i = 1 
 
rst_AUTHORIZATION.MoveFirst 
Do While Not rst_AUTHORIZATION.EOF 
For Each fld In rst_PMPROJS_TEMPLATE.Fields 
If fld.Name = "CONTRACT" Then 
PMPROJS.Fields("CONTRACT").Value = rst_AUTHORIZATION!Consumer 
ElseIf fld.Name = "PROJECT" Then 
PMPROJS.Fields("PROJECT").Value = rst_AUTHORIZATION!AUTH_ID 
ElseIf fld.Name <> "AUDTDATE" And fld.Name <> "AUDTTIME" And fld.Name <> "AUDTUSER" And _ 
fld.Name <> "AUDTORG" And fld.Name <> "DATELASTMN" And fld.Name <> "STARTDATE" And _ 
fld.Name <> "ORJENDDATE" And fld.Name <> "CURENDDATE" And fld.Name <> "ORATEDATE" And _ 
fld.Name <> "RATEDATE" And fld.Name <> "PLINENUM" And fld.Name <> "DETAILNUM" Then 
 
PMPROJS.Fields(fld.Name).Value = fld.Value 
End If 
Next fld 
 
PMPROJS.Fields("PLINENUM").PutWithoutVerification ("-" & i) 
 
The code execution halts here. 
PMPROJS.Insert 
PMCONTS.Update 
 
i = i + 1 
rst_AUTHORIZATION.MoveNext 
Loop 
 
DoCmd.Close acForm, Me.Name 
End Sub
 
 
[+][-]03.20.2008 at 11:23AM PDT, ID: 21174201

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 03:10PM PDT, ID: 21176371

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 10:39PM PDT, ID: 22424523

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628