Delete queries on a form

  • Thread starter Thread starter David
  • Start date Start date
David said:
Hi there

I need help to assign a delete query to a command button
on a form!

Well, in VB this works:
db.Execute ("DELETE FROM students WHERE studentCode = 'somecode'")

Of course DB is the name *I* chose in my program for the database
connection. I have no idea what name Access uses for it's own self
generated forms, and I've spent some amount of time trying to find out!



Adrian
 
-----Original Message-----



Well, in VB this works:
db.Execute ("DELETE FROM students WHERE studentCode = 'somecode'")

Of course DB is the name *I* chose in my program for the database
connection. I have no idea what name Access uses for it's own self
generated forms, and I've spent some amount of time trying to find out!



Adrian


.
Hmmm, thanks Adrian for the reply.

However, my problem gets a bit more complicated now. I've
designed a delete query and it works fine, but i want to
put that query on a form...somehow. I tried assigning it
to a command button, but it won't let me select the
delete query. I was thinking maybe Access won't let u
put a delete query on a form???

Any clues?
 
Its all ok, i found it. The wizard never allowed me to
select the delete query, so i selected another query, went
into the code, and changed the name of the selected query
to the one that i wanted. Thanx Adrian for you help!!
 
However, my problem gets a bit more complicated now. I've
designed a delete query and it works fine, but i want to
put that query on a form...somehow. I tried assigning it
to a command button, but it won't let me select the
delete query. I was thinking maybe Access won't let u
put a delete query on a form???

The wizards (and the Documenter) apparently can't see delete queries.
It's a bug.

What you can do is use the wizard; pick some query that you *can* see;
then go into the VBA editor and edit the button's Click event code to
change the name of the query that's being executed.
 
Back
Top