Inoperative Command Button (Access 2K)

A

Anthony Law

I have a database which has a form which has several
buttons on it. One my "cmdAddNew" button dosen't work.
It did before I got greedy and tried to change the locking
properties of my form/table/query. :-( Anyway this is the
code for my problem button

*****************************************************
Private Sub cmdAddNew_Click()
On Error GoTo Err_cmdAddNew_Click

DoCmd.OpenTable "tblChange_Request_1", , acAdd
DoCmd.GoToRecord acDataTable, "tblChange_Request_1",
acLast
DoCmd.Requery

Exit_cmdAddNew_Click:
Exit Sub

Err_cmdAddNew_Click:
MsgBox Err.Description
Resume Exit_cmdAddNew_Click

End Sub
*********************************************************

The rest of my controls work perfectly.
 
S

Steve Schapel

Anthony,

The first thing I noticed is that I can't seem to understand the 2nd and
3rd lines of your code. If the table is being opened in Add mode, all
you will see is the new record, so going to the "last" record is not
actually possible, no matter what. And Requery for a table doesn't make
sense. All that is needed is...
DoCmd.OpenTable "tblChange_Request_1", , acAdd

Having said that, the purpose of tables is background storage of data,
and should normally only be seen during the design and debugging phases
of database development. Whereas it is theoretically possible to use
them for data entry/editing, there are many problems associated with
this approach. The database object which is applicable for entry,
editing, and viewing of data is the Form.

When you say "doesn't work", what exactly does this means. Table
doesn't open? Table opens but no records available? Nothing at all
happens? Error message? Something else?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top