I have an Access2003 database that we are converting the backend tables to SQL Server Express. Since this is one of my first times dealing with SQL Server Express, I am having a few issues with one of the programs. Basically it takes a temporary file created in the Access database and it needs to update two tables in the SQL database. I have part of the code below - the temporary file is tblRegister. If there is another way I need to do it, please let me know. Also if anyone has a code example of how I should open the tables and loop thru them - update and exit, that would be great. Thanks. - Private Sub cmdPost_Click()
-
Dim db, ldb As Database
-
Dim rstR, rstC, rstT As Recordset
-
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
-
Dim Lst As ListBox
-
Dim strFill As String
-
Set Lst = Me![lstMCNumbers]
-
Style = vbYesNo ' Define buttons.
-
Title = "Post registry" ' Define title.
-
Help = "" ' Define Help file.
-
Ctxt = 1000 ' Define topic
-
' context.
-
' Display message.
-
Response = MsgBox("Post Registry into Customer list?", Style, Title)
-
If Response = vbYes Then
-
Set db = CurrentDb()
-
'Set db = OpenDatabase("n:\TestData\PascoData_041107.mdb")
-
Set ldb = CurrentDb()
-
Set rstR = ldb.OpenRecordset("tblRegister")
-
'Set rstC = db.OpenRecordset("tblCustomers", dbOpenSnapshot, dbSeeChanges)
-
''Set rstT = db.OpenRecordset("tblTransactions", dbOpenSnapshot, dbSeeChanges)
-
-
'rstR.MoveFirst 'take out
-
Do While Not rstR.EOF
-
rstC.FindFirst = "MCNumber=" & rstR.MCNumber '<if MCNumber is numeric
-
-
' rstC.Index = "MCNumber" 'take out
-
' rstC.Seek "=", rstR.MCNumber 'take out
-
If rstR![PostIt] = True Then
-
If rstC.NoMatch Then
-
rstC.AddNew
-
rstC![MCNumber] = rstR![MCNumber]
-
rstC![DOTNumber] = rstR![MCNumber] ''03/27/07 added by DRA for DOT#
1 1840
Hmm, taking the hard way...
I would create unique indexes on the SQL Server tables and use an INSERT query in Access to add the not existing rows.
As the Unique index will prevent duplicates to be inserted, this is a safe (and fast) way to add new rows into a table.
Getting the idea ?
Nic;o)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Mark B |
last post by:
We have an Access app (quite big) at www.orbisoft.com/download.
We have had requests by potential users to have it converted to an SQL
version for them since there corporate policy excludes them...
|
by: Doug Vogel |
last post by:
Hi All -
I have a client for whom I developed an Access 2000 database. The
database is split into 2 files - front-end (forms, queries, reports),
and back-end (tables). An .mde file has been...
|
by: htmlgeek |
last post by:
I'm adding and updating records in an Access .mdb via WWW .asp page.
Authored in Dreamweaver 2004 MX.
Help is welcome on this one. I have a great set of pages that work
fine, but it seems that...
|
by: Yannick Turgeon |
last post by:
Hello,
We are in the process of examining our current main application. We have to
do some major changes and, in the process, are questionning/validating the
use of MS Access as front-end. The...
|
by: girlkordic |
last post by:
I have a linked table from an Oracle database (that contains HR
information for my company)in an Access database. The Oracle DB is
updated on a daily basis. I would like one of my tables in...
|
by: mark |
last post by:
Please excuse this blatant attempt at advertising. I hope you find this
software both interesting and useful.
http://www.caddproductivity.com/dataswap.htm
Data Swap
The Data Swap program...
|
by: |
last post by:
I am updating MS access tables with data in an xml
document. I create two dataset, one for existing data and
one for new data. I fill the first dataset with the
records from MS Access, the second...
|
by: thomasp |
last post by:
First of all, thanks for the help on my previous VB.NET/MS Access questions.
This time I need do the following
1. Connect to a table
2. step through each of its records
3. read the value of two...
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to...
|
by: BFoxDDS |
last post by:
i'm sure this is simple to do, but i can't find the answer in the
search engines.
i have an access db with 400,000 records. i produce queries of 5,000
records at a time exported into an excel...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |