473,404 Members | 2,179 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,404 software developers and data experts.

Linked SQL Table into Access -1 doesn't register

I have a table that has always been in my back-end of this application.
The table is getting quite large, and, on top of that, we lose records
out of this table. They just dissappear! No rhyme or reason to it.

I imported the table into SQL, and re-linked it back into the front end
of the application. All the fields show. I had to pick a primary key,
which is fine, it's a text field (nvarchar 255), and it is indeed a
unique value.

The problem started when I tried to use a simple query on this table.
The query is in access, SQL reads:

select * from catalog where catalog.exists = -1

even though -1 be a value in the exists field in catalog, (0 is the
other value) it doesn't return a lick of data. If I change the query
to:

select * from catalog where catalog.exists <0

then the query returns the proper record set. Anyone have any idea why
this could be happening?
In access (the old table) catalog had exists as a type Yes/No. Default
was no. In SQL, during the import the data type was changed to (Bit
Length 1, Not Null). Bit sounds problematic here, I'm really wanting a
true/false. Shouldn't it be boolean? Is there a boolean as a SQL
type, would this be more appropriate for a true/false situation? Am I
going to run into lots of problems with data types that get
auto-converted from access into SQL?

I noticed that SQL wants to bracket many of field names I have used
previously in this table in Access. User, Desc, Exists, Group, Open,
Close. This table is so big and unwieldy, and there is the problem of
the losing records, so I feel like I must put it in SQL to get a handle
on it - Access has no way to keep track of who or what is deleting a
record. My understanding is that it is possible to turn auditing of
some kind on SQL so that I can figure out who/what is deleting those
records.

Sorry too many questions in one post.
Thanks in Advance!

-BrianDP
Accessor on the move to SQL

Oct 16 '06 #1
6 1664
Greetings,

If you are certain that rows in your table are being removed, then I
would guess that some procedure in your Access front end is causing this
to happen or some user is unwittingly removing rows. Nothing happens
just by chance. Only some action can cause rows to be removed.

As for auditing deletes on the table, this is easy. Now that your table
is in a Sql Server DB, you can write a delete trigger with a timestamp
to write the deleted row to another table so you can look at it. Matter
of fact, if you don't want rows to be able to be deleted from the table
you can use a trigger like this one:

Create Trigger t_NoDeletes On dbo.tbl_yourTbl
For Delete

As

rollback transaction
declare @s varchar(50)
set @s = 'No deleting allowed from tbl_yourTbl
RaiseError (@s, 16, 10)

Return

actually, in the body of the trigger (after the AS keyword) you only
need >rollback transaction << to prevent deletes. But I like to add a
message so that people know that deletes won't happen on this table.
RaiseError will raise a messagebox in Access with the message I
included.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Oct 16 '06 #2
Here is a better version of the dontDelete trigger

Create Trigger t_NoDeletes On dbo.tbl_yourTbl
Instead Of Delete

As

RaiseError ('Deleting not allowed on this table!', 16, 10)
rollback transaction

Return

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Oct 16 '06 #3

Rich P wrote:
Here is a better version of the dontDelete trigger

Create Trigger t_NoDeletes On dbo.tbl_yourTbl
Instead Of Delete

As

RaiseError ('Deleting not allowed on this table!', 16, 10)
rollback transaction

Return

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Rich,
not to totally hijack this post, but do you have any good references
for migrating to SQL Server and/or upsizing to SQL Server? I know
Baron & Chipman's book is good... is there a new ones coming for SQL
Server 2005?

Thanks
Pieter

Oct 17 '06 #4
Actually, I am in your boat on this. We are migrating to Sql Server
2005 over at my place, and I don't have any solid reference books on it.
But I do subscribe to a sql server journal where I am currently getting
most of my information. Just type sql server journals in google, and
that will bring up several publications.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Oct 17 '06 #5
Rich,

Thanks for the nodelete script. I've suspected it was something in my
front end for years.

I hate to be a bugger, but what about the bit/binary question? Binary
seems like a more logical choice for a Yes/No type of question. I
assume the values for Binary are 0/1? So, um, typically in C anyway, 0
is no, and -1 is Yes, so if my supposition about SQL's Binary is
correct, 0/1, 0 would be no/False, and 1 would be Yes/true? Do I need
to somehow write this into the DTS that imports the table?

Seems like I'm going to have a few roadblocks when I come to converting
stuff straight from Access to SQL. The Wiazards would have you belive
"Just use the import script!" It'll create the DTS for you, and
violla! You're finished! Nothing ever seems so simple as that though,
especially if you're letting a wizard do the work for you. Maybe what
I do, is create a new field in the imported table, that is my new
binary field, and populate it from the Access side with some vb code,

sub convertexistsbutton()

dim db as database
dim rst as recordset

set db = currentdb()
set rst = db.openrecordset("catalog")

rst.movefirst
do while not rst.eof
rst.edit
if rst!exists = 0 then
rst!bin_exists = 0
else
rst!bin_exists = 1
end if
rst.update
rst.movenext
loop

end sub

Sweet aircode! I love VB/Access.....
Someone let me know if there is a problem with this since I"m dealing
with an attached SQL db..

TIA!

-BrianDP
Laboring with SQL Conversion
On Oct 16, 5:31 pm, Rich P <rpng...@aol.comwrote:
Here is a better version of the dontDelete trigger

Create Trigger t_NoDeletes On dbo.tbl_yourTbl
Instead Of Delete

As

RaiseError ('Deleting not allowed on this table!', 16, 10)
rollback transaction

Return

Rich

*** Sent via Developersdexhttp://www.developersdex.com***
Oct 17 '06 #6
Bri
I hate to be a bugger, but what about the bit/binary question? Binary
seems like a more logical choice for a Yes/No type of question. I
assume the values for Binary are 0/1? So, um, typically in C anyway, 0
is no, and -1 is Yes, so if my supposition about SQL's Binary is
correct, 0/1, 0 would be no/False, and 1 would be Yes/true? Do I need
to somehow write this into the DTS that imports the table?
Yes, Bit can be either 0 or 1. Access' Boolean field is -1 or 0. I often
convert to an SmallInt rather than to Bit so I can continue to store -1
and 0. Yes, its a waste of space, but it reduces the amount of code you
have to check over. If you do convert to Bit, you can use comparisons to
True or False then Access will send the correct request to SQL Server,
but if you compare to -1 it will look for that value and it can't exist.

--
Bri

Oct 17 '06 #7

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

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
5
by: deko | last post by:
How to run action query against linked table? I have an Access 2003 mdb with an Excel 2003 Workbook as a linked table. When I attempt to run an action query against the linked table I get this...
7
by: Joe | last post by:
I am using Access 2003 and are linking to an Oracle 9i ODBC datasource (using Oracle ODBC drivers). After linking the tables in Access, I inspect the data contained in the linked tables. For...
5
by: Biguana | last post by:
Hi, Wondering if anyone can help with an append query I'm running in Access. It should add records from an Access table to a linked SQL Server table (linked via ODBC). I run the query by...
2
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database,...
10
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on...
0
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may...
4
by: christianlott1 | last post by:
I've linked an excel worksheet as an access table. The values appear but it won't allow me to change any of the values. To test I've provided a fresh blank workbook and same problem. I've done...
3
by: nzaiser | last post by:
Hello! This is my first time asking a question here, so please bear with me if I seem 'unconventional!' My issue is this..... OS: Windows_NT App: MS Access 2000 (also in 2003) ODBC linked...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.