Anyone good with MS Access?

Savatage
Member Posts: 7,142
Got a question. I have a nav tabel called "Posted Mail Packages" I have an Access Table called "Mail Pkg".
Our mail shipping software fills the Access table with information like "Order Number" & "Tracking Number".
We are not using SQL so A direct link is out.
When I run an Append query it moves the data from Access into Nav. Works fine until you try it the second time. Both tables have "Order Number" & "tracking Number" as their keys. So on the second run Nav throw an error that the records already exists.
So the bottom line question is how do I have Access look to see is the record exists and skip it if it does when trying to insert records using an Append Query?
I've thought about having my access table have an "Imported" field that gets updated to yes once the query is run but I don't know how to do that either ](*,)
All the posts I've read online..I'm having a hard time following.
Our mail shipping software fills the Access table with information like "Order Number" & "Tracking Number".
We are not using SQL so A direct link is out.
When I run an Append query it moves the data from Access into Nav. Works fine until you try it the second time. Both tables have "Order Number" & "tracking Number" as their keys. So on the second run Nav throw an error that the records already exists.
So the bottom line question is how do I have Access look to see is the record exists and skip it if it does when trying to insert records using an Append Query?
I've thought about having my access table have an "Imported" field that gets updated to yes once the query is run but I don't know how to do that either ](*,)
All the posts I've read online..I'm having a hard time following.
0
Comments
-
My english is not native english so I don't quite understund you question, but if you must read data from acess and put it in NAV, you can use ADO in NAV like this and manipulate vith data:
Name DataType Subtype
DataConnection Automation 'Microsoft ActiveX Data Objects 2.8 Library'.Connection
DataRecSet Automation 'Microsoft ActiveX Data Objects 2.8 Library'.Recordset
adoFields Automation 'Microsoft ActiveX Data Objects 2.8 Library'.Fields
Code like this:
xDBPath:=
'C:\database path\Database.mdb';
ConStr := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + xDBPath ;
CREATE(DataConnection);
DataConnection.ConnectionString := ConStr;
DataConnection.Open;
xCmdTxt:=
'SELECT * FROM SOMETABLE'
DataRecSet:=DataConnection.Execute (xCmdTxt);
DataRecSet.MoveFirst;
WHILE NOT(DataRecSet.EOF)
DO
BEGIN
adoFields:=DataRecSet.Fields;
PopulateFields(adoFields,DnevnikRec);
DataRecSet.MoveNext;
END;
PopulateFields function is like:
Var Name DataType Subtype Length
Ne adoFields Automation 'Microsoft ActiveX Data Objects 2.8 Library'.Fields
ForItmesCount:=1;
ItmesCount:=adoFields.Count;
WHILE ForItmesCount<ItmesCount+1 DO
BEGIN
adoField:=adoFields.Item(ForItmesCount-1);
ValueVariant:=adoField.Value;
ValueDec:=0;
ValueInt:=0;
ValueDate:=0D;
ValueText:='';
ValueBoolean:=FALSE;
IF ValueVariant.ISTEXT THEN ValueText:=FORMAT(ValueVariant);
IF ValueVariant.ISDECIMAL THEN ValueDec:=ValueVariant;
IF ValueVariant.ISINTEGER THEN ValueInt:=ValueVariant;
IF ValueVariant.ISDATE THEN ValueDate:=ValueVariant;
IF ValueVariant.ISBOOLEAN THEN ValueBoolean:=ValueVariant;
ForItmesCount+=1;
CASE adoField.Name OF
'FieldName' : BEGIN
someRec.Field:=ValueInt;
END;
END;
END;0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions