By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,378 Members | 3,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,378 IT Pros & Developers. It's quick & easy.

conditional query in access db

P: n/a
Hello,

In access db (2002),
How can I make the equivalent :

something like the pseudo code :

if not exists (
select ... from table_name) then
insert into table...
else
update table.
In Oracle it is :
begin
update table where id = ...
if sql%notfound then
insert into ...
end if;
end;

How can I do the above in MS-Access.

Need sample code, please.

Thanks :)
May 24 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You cannot do this in a single Access query. The equivalent Microsoft tool
for Oracle is SQL Server, in which you would use T-SQL and write a very
similar stream of SQL/T-SQL to what you posted.

To do something similar in Access, you will have to write some VB. One
approach would be to create a form dedicated to this process, with a button
that starts it. Inside the module you could use VB to test the conditions
you're looking at and then either run saved Access queries or execute the
SQL directly off the database object with .EXECUTE.

In access db (2002),
How can I make the equivalent :

something like the pseudo code :

if not exists (
select ... from table_name) then
insert into table...
else
update table.
In Oracle it is :
begin
update table where id = ...
if sql%notfound then
insert into ...
end if;
end;

How can I do the above in MS-Access.

Need sample code, please.

Thanks :)

May 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.