Adding a record does not populate db?

D

DS

Hoping this easy as I am new to Access.

Using Access 2000 and have a basic db. Users just Add, Update and Delete
records in a standard form.

The problem is if any user ADDs a record, that new record is not visible to
other users unless they exit and re-enter the db.

But if someone UPDATEs an existing record, that update is visible to all
users.

If someone DELETES a record, the record is still there for other users but
each field is filled in with "#DELETE" until they exit and reenter.

What is not set properly where the New records are not visible to other users?

I appreciate and input.

DS
 
D

Dennis

There is a lag between database operations and their being written from cache
to the database. Your application should have a DBEngine.Idle dbRefreshCache
command included, which refreshes users' data with the most current. It also
forces flushing cached database operations to the database.
 
J

John Spencer

How is your database set up?

Do you have a front-end (forms, reports, etc) and a back-end (just the data
tables)?

You can add a button to your entry form that the user's can press to
requery the source for new records. Or you can put the requery in a timer
event - little more dangerous because requery will move them off the current
record whether they are ready to move or not.

The code for the requerying a form's data source is
Forms!YourFormName.Requery
or if you are running the code from the form's module you can use
Me.Requery

I'm not sure that dbEngine.Idle dbRefreshCache will solve your problem, but
it couldn't hurt to try it and see if it solves your problem.

You could use code to requery the recordsource upon entering each record.
But that could significantly slow the operation of entering and updating
data.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
D

DS

John:

No front and backend. Just a very basic db. (One of my first)
I have a button on the page that runs this:


Private Sub Command15_Click()
On Error GoTo Err_Command15_Click

DoCmd.GoToRecord , , acNewRec

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click

End Sub

Would I just add the: dbEngine.Idle dbRefreshCache
after the acNewRec ?
 
J

John Spencer

Try the following.
Private Sub Command15_Click()
On Error GoTo Err_Command15_Click

dbEngine.Idle dbRefreshCache
DoCmd.GoToRecord , , acNewRec

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click

End Sub

If that doesn't work for you then try

Private Sub Command15_Click()
On Error GoTo Err_Command15_Click

'Force the record to save if it has been added or changed
IF Me.Dirty then Me.Dirty = False

'Requery the data
Me.Requery
'Add a new record
DoCmd.GoToRecord , , acNewRec

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click

End Sub

In my opinon, if you have multiple people in this data base at the same
time, you are going to have problems with your data. I suggest that you
look at splitting your database.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
D

DS

Thanks John and everyone else!

I added a requery button to the form. A certain group usually inputs and
another does lookups. For now I have instructed the look-up folks to hit the
requery button to refresh the db.

The dbEngine.Idle dbRefreshCache did not work.

I will try the IF Me.Dirty then Me.Dirty = False as well.

For now they are happy. I guess I did not realize new records needed to be
refreshed in order to be visible.

I appreciate everyones quick responses and great help.

Dave
 

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