delete a record from a query

S

Spencer Hutton

i have a form that gets its data from a query. that query is tied to
basically one table, the second table is merely a lookup table to pull a
employee name from their id number. is there a way to delete the main
table's record from this form?
 
R

RobFMS

You have two options.

1. Write VBA code to take the existing record you are viewing on the form
and delete it. If you need assistance with this, just let the newsgroup
community know.

or

2. Use the command button wizard to assist you in creating a button that
will delete the existing record. If you are new to Access or VBA
programming, this may be the better choice for the moment.

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
S

Spencer Hutton

i did use the commandbutton wizard, but when it is clicked, it just makes a
error beep, and nothing happens, no error dialog or anything.
 
R

Roger Carlson

When it beeps, look in the status bar. If it says something like "Recordset
is not updateable", then you have your answer. If the recordset is not
updateable, you can't delete records either. The main way that a recordset
based on a query of two joined tables can be non-updateable, is if the field
in the lookup table does not have a unique index. In a query with a
one-to-many join, the table on the "One" side MUST have a unique index on
the join field(or it should be the primary key).

Other things can cause a query to be non-updateable: Using the DISTINCT
predicate, making the query a "totals" (aggregate query), and so forth. If
you type "When can I update data from a query?" into the Answer Wizard in
help, you will find a list of reasons that can cause a query to be
non-updateable.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Top