473,385 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Importing Same Name Tables into updated db

Thank you in advance. I have a database that I've written in Access 97 and have
some clients using the program. My question is, when I update tables, so they
don't loose their data, is there a way to import, without creating an update
query in Access their records?

The table names and field names are identical, except for any fields added
since the last update. The software is in Beta testing! Is there a way to do
this?

Michael
Nov 12 '05 #1
5 1499
On 11 May 2004 14:08:40 GMT, lu*************@aol.com (Lumpierbritches)
wrote:

An elegant approach is to at startup time check if the database
structure update code needs to be run, and if yes, run a routine that
uses CreateField, CreateIndex and similar functions to port the db
design to the new version.

-Tom.

Thank you in advance. I have a database that I've written in Access 97 and have
some clients using the program. My question is, when I update tables, so they
don't loose their data, is there a way to import, without creating an update
query in Access their records?

The table names and field names are identical, except for any fields added
since the last update. The software is in Beta testing! Is there a way to do
this?

Michael


Nov 12 '05 #2
But HOW? Is what I'm asking.
Nov 12 '05 #3
> My question is, when I update tables, so they
don't loose their data, is there a way to import, without creating an update
query in Access their records?


Can you clarify what you mean by update tables in this sentence? Do you have
two versions of the application running at the same time?
Nov 12 '05 #4
There are two versions, same table name, additional fields in those tables, so
just importing the tables won't work and forms that I wish to take data with
the same table name, and field names and import them into the updated db? Is
that clear enough?

I'm looking to update and append table records with information in tables
currently, into an appended table database, with additional fields.

The two tables may have 100 fields identical, but the new table has additional
fields the old table didn't but all the same fields as the new table; does that
make sense?

It's beta software that we're adding fields to as we determine there is a need.

Michael
Nov 12 '05 #5
CDB
"Lumpierbritches" <lu*************@aol.com> wrote in message
news:20***************************@mb-m21.aol.com...
But HOW? Is what I'm asking.


Well, here's how I do it, especially with customers 12,000 miles away. Some
in this NG argue (vociferously) that such changes result from design/program
incompetence. And that is sometimes true. But if a business is not
developing it is collapsing; change is part of the deal.

As part of the startup checking, and after the data file has been verified,
this code runs -
("dlg" and "errdlg" are part of my message/log system, using a table for the
messages.)

'check fixes
lngCurrVersion = SysVal.DataVersion
Select Case lngCurrVersion
Case cbDataVersion
Case Is > cbDataVersion
dlg 10
GoTo procexit
Case Is < lngFirstVersion
dlg 8
GoTo procexit
Case Else
If Fixit(lngCurrVersion) = False Then
dlg 30
GoTo procexit
End If
End Select
IniOK = True

It gets current datafile version from sysrec table, and compares it
matches the dataversion this Front End db is designed to run with
(cbDataVersion), then skip
greater than cbDataVersion, then FE is old and should be updated
is too early and BE should not be used
else calls Fixit
Public Function Fixit(lngCurrVersion As Long) As Boolean
'^^^^^^^^^^^^^^^^^^^^^^^^^
'called from IniVal
Dim bStatus As Boolean
On Error GoTo procerr
bStatus = False
If OpenFixes() = False Then
GoTo procexit
End If
'insert new fix here, plus update cbDataVersion in GlobalStuff
If lngCurrVersion < 20040419 Then fix20040419
If lngCurrVersion < 20040426 Then fix20040426
If lngCurrVersion < 20040427 Then fix20040427

SysVal.SetVals
bStatus = True
procexit:
On Error Resume Next
CloseFixes
Fixit = bStatus
Exit Function
procerr:
errdlg "Fixit", Err.Number, Err.Description
Resume procexit
End Function

It will run as many fixes as needed.
App can have multiple data files - eg another company, test system, restored
from BU, etc. So more than one BE may need updating over time.
Private Function fix20040428() As Boolean
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Const fixno As String = "20040428"
Dim strSql As String
On Error GoTo procerr
'1
AddField "Repairs", "CustDownAmt", "MONEY"
'2
strSql = "UPDATE CustDown INNER JOIN Repairs ON CustDown.ID =
Repairs.RepairID SET Repairs.CustDownAmt = [DownAmt];"
IniVal.ProgDb.Execute strSql
'3 remove 0/null terms
strSql = "DELETE FROM Financing WHERE ((Financing.FinanceAmt=0 Or
Financing.FinanceAmt Is Null));"
IniVal.DataDb.Execute strSql

procexit:
strSql = "UPDATE Sysrec SET Sysrec.DataVersion = " & fixno & ";"
IniVal.DataDb.Execute strSql
fix20040428 = True
Exit Function
procerr:
errdlg "Fix" & fixno, Err.Number, Err.Description
Resume Next
End Function

The above sample proc adds a field to a table (proc not shown), fixes two
data problems, then updates the data version of the BE.
This ensures only the first in will attempt the update.
I have not used .Execute ... dbFailOnError as I want it to continue. The
messaging and logging alert me to the need to deal urgently with the problem
that arose, and I do not want every startup to run into the same error - so
the BE data version number is updated anyway.

(In 2, I included a short-term FE table holding 20,000 values to update the
new field, and because it was in the FE, I had to use the ProgDb rather than
the DataDb used in preference.This was 2 days after installation. Messy.)
The following are just housekeeping.

Private Function OpenFixes() As Boolean
'^^^^^^^^^^^^^^^^^^^^^^
Dim bStatus As Boolean
On Error GoTo procerr
bStatus = False
DoCmd.Hourglass True
DoCmd.OpenForm "FixitMsg", acNormal, , , , acWindowNormal
SysCmd acSysCmdSetStatus, "Applying updates to data tables..."
bStatus = True
procexit:
On Error Resume Next
OpenFixes = bStatus
Exit Function
procerr:
errdlg "OpenFixes", Err.Number, Err.Description
Resume procexit
End Function

Private Sub CloseFixes()
'^^^^^^^^^^^^^^^^^^^^^^
On Error Resume Next
DoCmd.Close acForm, "FixitMsg"
SysCmd acSysCmdClearStatus
DoCmd.Hourglass False
procexit:
Exit Sub
End Sub

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Brenda | last post by:
How can I change the name of a table as I import it? I have a form in Access that needs to accept files from different sources (mainly dBase III). I need one field out of these tables, called...
5
by: dixie | last post by:
If I sent a user an empty database container - dB with no tables and I needed them to import their tables into it and one of their tables was a hidden table with the prefix Usys, is there any way...
17
by: OdAwG | last post by:
Just some questions regarding tables. I am new Access Database and need a little help. I have the following data listed below 01. I have a table called tbl_Customer with the following...
11
by: kaisersose1995 | last post by:
Hi, I've got an import procedure working, using a standard import specification to import a .csv file into a temporary table. The problem i'm having is that i have 4 different sets of borrower...
12
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the...
4
by: JamesSykes | last post by:
Hi, I am relatively new to Access and VBA. I am trying to import a number of database files (just really want the contents of their tables) from a specified folder into a master table that...
1
by: gollumullog | last post by:
Good Day, I have been having this issue for quite a long time, and have yet to find an easy/elegant solution. I am trying to create tables in an Access database. I have these tables as CSV...
0
by: Shootah | last post by:
Hi, I have succeeded in adding automated relationships with refference tables after importing an excel file created from a query to an Access database. However I have the following problem: ...
2
by: awigren | last post by:
I just finished my database, and now I have to import the updated information into the tables that already exist so that all the links stay the same. I had a person in the office assisting me, but...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.