473,785 Members | 2,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Temporarily remove referential integrity checks through VBA?

Hi

I'm creating a series of forms, each with with around 15-20 text boxes.
The text boxes will show data from tables, but are unbound to make them
more flexible.

I want the form to be used for both adding new data and modifying
existing data. I have created a save button on the form.

When the user clicks the save button, the code checks to see if there
is a value in the ID text box. If not, it assumes that the record is
new and uses an "Insert into..." SQL statement as the ADODB command
text. This works fine.

However, if there is already an ID value present, the logic is that the
record already exists, and therefore we are doing an update. Creating a
SQL statement along the lines of "UPDATE tblCustomers SET strFirstName
= " & txtFirstName.te xt & ", strLastName=" & txtLastName.tex t
...... and so on seems to be a lot of coding to update perhaps 14 fields
which haven't changed in addition to the one that may have.

Therefore, my question is this: Is there an easy way to detect which
field has been changed (without writing code behind each text box,
given that Access doesn't allow control arrays... It probably seems
like I'm being lazy, but with probably 8 or so forms, each with 15-20
text boxes, that would be a lot of work!)

Assuming not, my other thought was that it would be much simpler to
simply execute 2 commands -
"Delete from tblCustomers where ID=" & txtID.text
and then run the insert statement as before. However, this will of
course be prevented by the referential integrity constraints on the
table, thus my question - is there a way through the code to turn off
checks, run the delete and insert statements, then turn them on again?

Apologies for being long-winded! Any help gratefully received!

Regards
Andrew Richards

Jun 15 '06
80 7896
rkc wrote:
Referential integrity is not an SQL concept.
It's a relational database design concept.


You got it in the end!

To relate back your original enquiry, 'What does SQL have to do with
referential integrity?' If you want declarative referential integrity,
SQL's got it (Jet SQL's got it so I guess you can say Access's got it
too).

HTH,
Jamie.

--

Jun 20 '06 #41
good stuff
IF EXISTS (SELECT TOP 1 'X' FROM newsgroup WHERE tool_of_choice =
'MDB')
BEGIN
RAISERROR ('oh wait a second mdb can't handle real tsql
statements; it is for babies', 16, 127, 'horsecrap')
END


Terry Kreft wrote:
IF EXISTS (SELECT * FROM newsgroup WHERE user_name = 'aaron')
BEGIN
DELETE FROM newsgroup WHERE user_name = 'aaron'
RAISERROR ('Troll alert - %d talking garbage', 16, 127, 'aaron')
END
--

Terry Kreft
<aa*********@gm ail.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
fucking retards

SQL Server is more powerful
anyone that uses MDB in the year 2006?

you should spit on them.
out of the blue; just walk up to them and spit.

you can have constraints-- you can have triggers-- you can have custom
dataTypes


rkc wrote:
Jamie Collins wrote:
> rkc wrote:
>
>>What does SQL have to do with referential integrity?
>
>
> http://en.wikipedia.org/wiki/SQL
>
> See the 'Concepts' section.

I didn't see any mention of SQL in the Referential Integrity
entry under that topic.


Jun 20 '06 #42
Don't trolls get bored of themselves ??
Not even sometimes ??

You are a horsecrap baby indeed ...

Arno R
<aa*********@gm ail.com> schreef in bericht news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
good stuff


IF EXISTS (SELECT TOP 1 'X' FROM newsgroup WHERE tool_of_choice =
'MDB')
BEGIN
RAISERROR ('oh wait a second mdb can't handle real tsql
statements; it is for babies', 16, 127, 'horsecrap')
END






Terry Kreft wrote:
IF EXISTS (SELECT * FROM newsgroup WHERE user_name = 'aaron')
BEGIN
DELETE FROM newsgroup WHERE user_name = 'aaron'
RAISERROR ('Troll alert - %d talking garbage', 16, 127, 'aaron')
END
--

Terry Kreft
<aa*********@gm ail.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
> fucking retards
>
> SQL Server is more powerful
> anyone that uses MDB in the year 2006?
>
> you should spit on them.
> out of the blue; just walk up to them and spit.
>
> you can have constraints-- you can have triggers-- you can have custom
> dataTypes
>
>
>
>
> rkc wrote:
> > Jamie Collins wrote:
> > > rkc wrote:
> > >
> > >>What does SQL have to do with referential integrity?
> > >
> > >
> > > http://en.wikipedia.org/wiki/SQL
> > >
> > > See the 'Concepts' section.
> >
> > I didn't see any mention of SQL in the Referential Integrity
> > entry under that topic.
>

Jun 20 '06 #43
no i dont get tired.

you pansies just look funny dancing around with your pink mdb files

oh; look at the little babies playing with MDB.. how CUTE!!!

-Aaron
Arno R wrote:
Don't trolls get bored of themselves ??
Not even sometimes ??

You are a horsecrap baby indeed ...

Arno R
<aa*********@gm ail.com> schreef in bericht news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
good stuff
IF EXISTS (SELECT TOP 1 'X' FROM newsgroup WHERE tool_of_choice =
'MDB')
BEGIN
RAISERROR ('oh wait a second mdb can't handle real tsql
statements; it is for babies', 16, 127, 'horsecrap')
END


Terry Kreft wrote:
IF EXISTS (SELECT * FROM newsgroup WHERE user_name = 'aaron')
BEGIN
DELETE FROM newsgroup WHERE user_name = 'aaron'
RAISERROR ('Troll alert - %d talking garbage', 16, 127, 'aaron')
END
--

Terry Kreft
<aa*********@gm ail.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
> fucking retards
>
> SQL Server is more powerful
> anyone that uses MDB in the year 2006?
>
> you should spit on them.
> out of the blue; just walk up to them and spit.
>
> you can have constraints-- you can have triggers-- you can have custom
> dataTypes
>
>
>
>
> rkc wrote:
> > Jamie Collins wrote:
> > > rkc wrote:
> > >
> > >>What does SQL have to do with referential integrity?
> > >
> > >
> > > http://en.wikipedia.org/wiki/SQL
> > >
> > > See the 'Concepts' section.
> >
> > I didn't see any mention of SQL in the Referential Integrity
> > entry under that topic.
>


Jun 20 '06 #44
I love the way that you have no compunction about showing how ignorant you
are of both transact SQL and Access SQL and the way that you're not afraid
of displaying your stupidity in public is really marvelous.
--

Terry Kreft
<aa*********@gm ail.com> wrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
good stuff
IF EXISTS (SELECT TOP 1 'X' FROM newsgroup WHERE tool_of_choice =
'MDB')
BEGIN
RAISERROR ('oh wait a second mdb can't handle real tsql
statements; it is for babies', 16, 127, 'horsecrap')
END


Terry Kreft wrote:
IF EXISTS (SELECT * FROM newsgroup WHERE user_name = 'aaron')
BEGIN
DELETE FROM newsgroup WHERE user_name = 'aaron'
RAISERROR ('Troll alert - %d talking garbage', 16, 127, 'aaron')
END
--

Terry Kreft
<aa*********@gm ail.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
fucking retards

SQL Server is more powerful
anyone that uses MDB in the year 2006?

you should spit on them.
out of the blue; just walk up to them and spit.

you can have constraints-- you can have triggers-- you can have custom
dataTypes


rkc wrote:
> Jamie Collins wrote:
> > rkc wrote:
> >
> >>What does SQL have to do with referential integrity?
> >
> >
> > http://en.wikipedia.org/wiki/SQL
> >
> > See the 'Concepts' section.
>
> I didn't see any mention of SQL in the Referential Integrity
> entry under that topic.

Jun 20 '06 #45
Terry;

screw yourself; I am much better at Access AND Sql than anyone i've
ever seen on this newsgroup.

And most importantly; I dont just blindly use the first tool the comes
across my desk.

I use the best tool for whatever I am doing.

Most of your idiots are unnecessarily biased agasint Access Data
Projects.
I find that laughable.
-Aaron
Terry Kreft wrote:
I love the way that you have no compunction about showing how ignorant you
are of both transact SQL and Access SQL and the way that you're not afraid
of displaying your stupidity in public is really marvelous.
--

Terry Kreft
<aa*********@gm ail.com> wrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
good stuff
IF EXISTS (SELECT TOP 1 'X' FROM newsgroup WHERE tool_of_choice =
'MDB')
BEGIN
RAISERROR ('oh wait a second mdb can't handle real tsql
statements; it is for babies', 16, 127, 'horsecrap')
END


Terry Kreft wrote:
IF EXISTS (SELECT * FROM newsgroup WHERE user_name = 'aaron')
BEGIN
DELETE FROM newsgroup WHERE user_name = 'aaron'
RAISERROR ('Troll alert - %d talking garbage', 16, 127, 'aaron')
END
--

Terry Kreft
<aa*********@gm ail.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
> fucking retards
>
> SQL Server is more powerful
> anyone that uses MDB in the year 2006?
>
> you should spit on them.
> out of the blue; just walk up to them and spit.
>
> you can have constraints-- you can have triggers-- you can have custom
> dataTypes
>
>
>
>
> rkc wrote:
> > Jamie Collins wrote:
> > > rkc wrote:
> > >
> > >>What does SQL have to do with referential integrity?
> > >
> > >
> > > http://en.wikipedia.org/wiki/SQL
> > >
> > > See the 'Concepts' section.
> >
> > I didn't see any mention of SQL in the Referential Integrity
> > entry under that topic.
>


Jun 20 '06 #46
db*******@hotma il.com wrote:
I am much better at Access AND Sql than anyone i've
ever seen on this newsgroup.


We're all grateful that you have shared your expertise here in CDMA.
But some of us may have missed one or two of your better contributions.
Would you list the links to a few, say ten, of your creative and
original posts so that we can reference them as a small library of
excellence?

In addition, this may help us to remember to maintain the appropriate
level of deferential integrity in our discussions with you.

Jun 20 '06 #47
Ha, ha, ha, it's just marvellous how you have not the slightest piece of
self-respect.

Please continue to show us how wonderful you are<g>; I've quite given up
reading Dilbert as your contributions are so much more originally funny.

You might not know much about programming (except in your world of course)
but you certainly know how to amuse!

I've only seen one piece of code from you and it was so laughably wrong but
far too subtle I thought, most people probably thought you meant it to be
like that.
--

Terry Kreft
<db*******@hotm ail.com> wrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Terry;

screw yourself; I am much better at Access AND Sql than anyone i've
ever seen on this newsgroup.

And most importantly; I dont just blindly use the first tool the comes
across my desk.

I use the best tool for whatever I am doing.

Most of your idiots are unnecessarily biased agasint Access Data
Projects.
I find that laughable.
-Aaron
Terry Kreft wrote:
I love the way that you have no compunction about showing how ignorant you are of both transact SQL and Access SQL and the way that you're not afraid of displaying your stupidity in public is really marvelous.
--

Terry Kreft
<aa*********@gm ail.com> wrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
good stuff
IF EXISTS (SELECT TOP 1 'X' FROM newsgroup WHERE tool_of_choice =
'MDB')
BEGIN
RAISERROR ('oh wait a second mdb can't handle real tsql
statements; it is for babies', 16, 127, 'horsecrap')
END


Terry Kreft wrote:
> IF EXISTS (SELECT * FROM newsgroup WHERE user_name = 'aaron')
> BEGIN
> DELETE FROM newsgroup WHERE user_name = 'aaron'
> RAISERROR ('Troll alert - %d talking garbage', 16, 127, 'aaron')
> END
>
>
> --
>
> Terry Kreft
>
>
> <aa*********@gm ail.com> wrote in message
> news:11******** *************@u 72g2000cwu.goog legroups.com...
> > fucking retards
> >
> > SQL Server is more powerful
> > anyone that uses MDB in the year 2006?
> >
> > you should spit on them.
> > out of the blue; just walk up to them and spit.
> >
> > you can have constraints-- you can have triggers-- you can have custom > > dataTypes
> >
> >
> >
> >
> > rkc wrote:
> > > Jamie Collins wrote:
> > > > rkc wrote:
> > > >
> > > >>What does SQL have to do with referential integrity?
> > > >
> > > >
> > > > http://en.wikipedia.org/wiki/SQL
> > > >
> > > > See the 'Concepts' section.
> > >
> > > I didn't see any mention of SQL in the Referential Integrity
> > > entry under that topic.
> >

Jun 21 '06 #48
<aa*********@gm ail.com> wrote in message
news:11******** **************@ h76g2000cwa.goo glegroups.com.. .
no i dont get tired.


I'm sure that one day we'll read a news item about you that concludes "...
before turning the gun on himself."
Jun 21 '06 #49
How a simple question has exploded!

Information AND entertainment - don't you just love newsgroups?!

:-)
Andrew

Keith Wilby wrote:
<aa*********@gm ail.com> wrote in message
news:11******** **************@ h76g2000cwa.goo glegroups.com.. .
no i dont get tired.


I'm sure that one day we'll read a news item about you that concludes "...
before turning the gun on himself."


Jun 21 '06 #50

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

Similar topics

1
3689
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into "access_log", the referential integrity triggers generate these queries: SELECT 1 FROM ONLY "public"."application_type" x
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10153
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.