Advertisement

05.09.2008 at 09:18AM PDT, ID: 23389978
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

importing from dat files(sorry for the book)(you will understand)
Tags: access mdb, adp, vba
         I work for a vehicle maintenance company.  the way they work is they have 7 different databases for 7 different aspects of the company.  all databases are identicle, just different data.  when a work order (an item we are repairing) goes into "U" status(means it has been picked up by the customer) it is soon purged from the databases.  this makes it dificult to make later reports.  i created a DTS program in msSQL 2005 that pulls in all their dat files when they do a backup, 3 a day, and right before they purge. in MSSQL i have 7 different databases that contain the most uptodate data from the lastest backup, Also when a Work Order enters U status i put that work order in an 8TH consolidated database of all closed work orders.  this has worked quite well and my workload has actualy increased 10 fold because everyone wants reports now but that is another project i am working on.  the problem i am having right now is that some reports that they want have data that we just dont have.  When i put an item in the closed database it only contains the most recent data from that workorder, and they want it based off of the original data.  For instance an engine comes in as one NSN or part number.  We do an upgrade to it and it because a completely new NSN, and the data in their database changes so when i pull data i only have the new NSN, they want the old.  I am now working on an mdb/adp, that will like to the sql tables and input the data.  i will still be using the backups but instead of just grabbing the most recent data i will kind of keep a running database.  
            I want to have an open Work order Table, and a closed work order table.  when i get a backup, i put the data into a temptable called tempWORF.  i then use an update query to update all but a few select fields in the openWORF table.  Next i add all records that are in the tempWorf table that are not in the openWorf table.  Next i added to the ClosedWorf table all records in the openWorf table that are not in the tempWorf table(meaning they have been purged).  last i delete from the openWORF table all records that are in the closedWorf(because they are not open).
         At first this didnt work at all but then i found out about transactions.  and it started working sort of.  I was getting alot of records in the closed worf table that were not closed.  so i messed around with it a little, now it doesnt work at all again, data gets put into the temp worf table but that is all
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:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
Private Sub ImpWonos(bkfldr As Folder, oldbkfldr As Folder)
    '*******************************************************************
    '*
    '*   IMPORT ALL DROPPED WONO'S
    '*
    '*******************************************************************
 
    
    Dim sql As String
    Dim wp1 As Workspace
    Set wp1 = DBEngine.Workspaces(0)
 
    'On Error GoTo DeleteDups
 
       
reImport:
'******Delete all records for tempworf before inserting new backup's records******
    wp1.BeginTrans
    sql = "Delete * from tempworf"
    CurrentDb.Execute sql
    wp1.CommitTrans (dbForceOSFlush)
'******Insert new backup's records for processing*********
    wp1.BeginTrans
    sql = "INSERT INTO tempworf " _
        & "SELECT [AHN03I#DAT].* " _
        & "FROM [Text;fmt=FIXED;DATABASE=" & bkfldr.Path & "\;].[AHN03I#DAT]"
    CurrentDb.Execute sql
    'wp1.CommitTrans
'******Update open worf table with data from new backup*******
    'wp1.BeginTrans
 
    wp1.CommitTrans
    wp1.BeginTrans
    sql = "UPDATE OpenWorf AS a INNER JOIN tempworf AS b ON (a.Wono = b.Wono) AND (a.ISCd = b.ISCd) AND (a.MaintActvDsg = b.MaintActvDsg) AND (a.SvcDsgUIC = b.SvcDsgUIC) SET a.EquipSNLCNFld = b.EquipSNLCNFld, a.ItemNomenItemNounFld = b.ItemNomenItemNounFld, a.WpnEquipSysDsgCd = b.WpnEquipSysDsgCd, a.EndItemCd = b.EndItemCd, a.CondDsgWrnt = b.CondDsgWrnt, a.ORFTrnsCd = b.ORFTrnsCd, a.PD = b.PD, a.DateAcptOrd = b.DateAcptOrd, a.DateComplOrd = b.DateComplOrd, a.WrStaCdCompl = b.WrStaCdCompl, a.WrStaCd = b.WrStaCd, a.OrdDate = b.OrdDate, a.MilTimeDa = b.MilTimeDa, a.WONBMA = b.WONBMA, a.QntyToBeRpr = b.QntyToBeRpr, a.QntyNRTS = b.QntyNRTS, a.QntyRpr = b.QntyRpr, a.QtyCondem = b.QtyCondem, a.MHProjTen = b.MHProjTen, a.MHExpTen = b.MHExpTen, a.MHRmnTen = b.MHRmnTen, a.EquipUtlCd = b.EquipUtlCd, a.ProjCd = b.ProjCd, a.APC = b.APC, a.CondDsgSDCIndic = b.CondDsgSDCIndic, a.FailDetcDuringCd = b.FailDetcDuringCd, a.MalfuncDescr = b.MalfuncDescr, a.MaintRprCd = b.MaintRprCd, a.CondDsgSNT = b.CondDsgSNT, " _
        & "a.EquipUseMeasCd1 = b.EquipUseMeasCd1 , a.UseAtSbmWR1 = b.UseAtSbmWR1, a.EquipUseMeasCd2 = b.EquipUseMeasCd2, a.UseAtSbmWR2 = b.UseAtSbmWR2, a.EquipUseMeasCd3 = b.EquipUseMeasCd3, a.UseAtSbmWR3 = b.UseAtSbmWR3, a.MaintSCDSvcDateOrd = b.MaintSCDSvcDateOrd, a.ShopSecCd = b.ShopSecCd, a.WONOrg = b.WONOrg, a.FILLER1 = b.FILLER1, a.RqrMaintCd = b.RqrMaintCd, a.EquipNo = b.EquipNo, a.EIId = b.EIId, a.EIPartNoFld = b.EIPartNoFld, a.EIEquipSNLCN = b.EIEquipSNLCN, a.MtrlDspoCd = b.MtrlDspoCd, a.ECC = b.ECC, a.CondDsgIsWO = b.CondDsgIsWO, a.MHExpTenCiv = b.MHExpTenCiv, a.MHExpTenKr = b.MHExpTenKr, a.MHExpTenLn = b.MHExpTenLn, a.MHExpTenMil = b.MHExpTenMil, a.DLbrCostCiv = b.DLbrCostCiv, a.DLbrCostKr = b.DLbrCostKr, a.DLbrCostLn = b.DLbrCostLn, a.DLbrCostMil = b.DLbrCostLn, a.IndLbrCost = b.IndLbrCost, a.TotEstRprPartCost = b.TotEstRprPartCost, a.CondDsgORF = b.CondDsgORF, a.DateEstWOComplOrd = b.DateEstWOComplOrd, a.DefLbrRateInd = b.DefLbrRateInd, a.CondDsgTransferable = b.CondDsgTransferable, " _
        & "a.CondDsgWOAvgCalc = b.CondDsgWOAvgCalc, a.WONBMA2 = B.WONBMA2, a.FILLER2 = B.FILLER2, a.STATUSDATA1 = B.STATUSDATA1, a.STATUSDATA2 = B.STATUSDATA2, a.STATUSDATA3 = B.STATUSDATA3, a.STATUSDATA4 = B.STATUSDATA4, a.STATUSDATA5 = B.STATUSDATA5, a.STATUSDATA6 = B.STATUSDATA6, a.STATUSDATA7 = B.STATUSDATA7, a.STATUSDATA8 = B.STATUSDATA8, a.STATUSDATA9 = B.STATUSDATA9, a.STATUSDATA10 = B.STATUSDATA10, a.STATUSDATA11 = B.STATUSDATA11, a.STATUSDATA12 = B.STATUSDATA12, a.STATUSDATA13 = B.STATUSDATA13, a.STATUSDATA14 = B.STATUSDATA14, a.STATUSDATA15 = B.STATUSDATA15, a.STATUSDATA16 = B.STATUSDATA16, a.STATUSDATA17 = B.STATUSDATA17, a.STATUSDATA18 = B.STATUSDATA18, a.STATUSDATA19 = B.STATUSDATA19, a.STATUSDATA20 = B.STATUSDATA20"
        CurrentDb.Execute sql
    sql = "INSERT INTO OpenWorf " _
        & "SELECT a.* " _
        & "FROM tempworf a LEFT JOIN OpenWorf AS b ON (a.Wono = b.Wono) AND (a.ISCd = b.ISCd) AND (a.MaintActvDsg = b.MaintActvDsg) " _
        & "WHERE ((b.Wono Is Null))"
    CurrentDb.Execute sql
'*******Add new items from the backup to the open worf table
 
    'wp1.CommitTrans
    'wp1.BeginTrans
        
        sql = "INSERT INTO worf " _
            & "SELECT  a.*,   '" & Right(bkfldr.Name, 10) & "' AS transferdate " _
            & "FROM  openworf a " _
            & "LEFT JOIN tempworf b ON a.MaintActvDsg = b.MaintActvDsg AND a.ISCd = b.ISCd AND a.Wono = b.Wono " _
            & "WHERE     (b.Wono IS NULL)"
        CurrentDb.Execute sql, dbFailOnError
        sql = "DELETE a.* " _
            & "FROM Worf AS b INNER JOIN OpenWorf AS a ON (b.Wono = a.Wono) AND (b.ISCd = a.ISCd) AND (b.MaintActvDsg = a.MaintActvDsg) AND (b.SvcDsgUIC = a.SvcDsgUIC)"
        CurrentDb.Execute sql
     wp1.CommitTrans
		
Exit Sub
DeleteDups:
    If Err.Number = 3022 Then
        CurrentDb.Execute "delete a.* from worf a inner join [Text;fmt=FIXED;DATABASE=" & bkfldr.Path & "\;].[AHN03I#DAT] b on  a.maintactvdsg = b.maintactvdsg and a.iscd = b.iscd and a.wono = b.wono"
        'GoTo reImport
        sql = "INSERT INTO worf " _
            & "SELECT  a.*,   '" & Right(bkfldr.Name, 10) & "' AS transferdate " _
            & "FROM  [Text;fmt=FIXED;DATABASE=" & oldbkfldr.Path & "\;].[AHN03I#DAT] a " _
            & "LEFT JOIN [Text;fmt=FIXED;DATABASE=" & bkfldr.Path & "\;].[AHN03I#DAT] b ON a.MaintActvDsg = b.MaintActvDsg AND a.ISCd = b.ISCd AND a.Wono = b.Wono " _
            & "WHERE     (b.Wono IS NULL)"
        Resume
    ElseIf Err.Number = 3058 Then
        Debug.Print
       ' CurrentDb.Execute DCount("WONO", "[Text;fmt=FIXED;DATABASE=" & bkfldr.Path & "\;].[AHN03I#DAT]")
    Else
        MsgBox "ERROR - " & Err.Number & " " & Err.Description & vbCrLf & BoxFldr & " " & bkfldr & " enditem", vbCritical
    End If
 
End Sub
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: talonsblade
Solution Provided By: MikeToole
Participating Experts: 1
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
05.12.2008 at 04:20AM PDT, ID: 21545900

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.12.2008 at 04:20AM PDT, ID: 21545900

Rank: Guru

I realise that you may not want to make such a sweeping change, but for what it's worth here's my suggestion:
Aim for a design that keeps just one set of tables in SQL Server with links to them from the Access front-ends.
1) Add a column, lets call it IDSection, to each  table that contains data that is different between the 7 instances of the front end, to identify which part of the company the data belongs.  
2) Create 7 views on each of these tables using IDSection to filter the data for one of your 7 front-end databases. If you don't include the new column in the output of the View then the data returned by the views will look exactly like the currrent mdb tables
3) Link each Access front-end to the views of the tables corresponding to the company section using the mdb. The table link wizard will give you Access table names that reflect the names of the View in SQL Server, rename the Linked tables to the original Access names. E.g for company section 1:
SQL Server
openWORF: Table containing all sections' data
vwOpenWORF_1: View filtering on IDSection = 1
Access mdb for section 1
openWorf: Table Linked to vwOpenWorf_1

There are then two alternatives to capture the data for historical reporting:
a) Use Triggers on your SQL Server tables to move data to historical tables for reporting when the data changes or before it's deleted.
b) Change the design so that closed orders are flagged as closed in the SQL Server table, rather than being physically deleted. The views that the Access front ends link to can filter-out the closed oreders so that the front-end doesn't see them.
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628