ADP Form not requering properly???

  • Thread starter Thread starter Jeff via AccessMonster.com
  • Start date Start date
J

Jeff via AccessMonster.com

I have an ADP front-end and on click of a save button I run the following
code:

me.dirty = false
me.requery

But the form is not refreshing. If I close the form and then re-open it the
record appears correctly . Any ideas?
 
Hello,
You wrote on Wed, 04 May 2005 02:42:07 GMT:

JvA> I have an ADP front-end and on click of a save button I run the
JvA> following code:

JvA> me.dirty = false
JvA> me.requery

If something is dirty, you have to wash it, not just declare that it's
clean. If the record was changed, you have to either commit the changes to
the database, or cancel them.

Vadim Rapp
 
I'm trying to save the record and refresh the form. The save is working
with they dirty method but it's not refreshing. I have to close the form
and re-open in order to view the record.

I also tried

Private Sub cmdSave_Click()

DoCmd.RunCommand acCmdSaveRecord
Me.Refresh

End Sub

But I get a message indicating "can't find the field forms"
 
I think the problem is that my primary key is set to null when I start
entering data into a new record. So any method I try to run crashes. I have
several subforms on my main form as well. If I close the form and re-open
it the record appears correctly.
 
Having a primary key set to null shouldn't be a problem with ADP, if this
field is an identity field on the SQL-Server. The form should insert the
new values and refresh the form automatically.

Usually, you don't need to use the Refresh command with bound forms, unless
you want to see edited values changed by other users or if you have made
change directly to the SQL-Server by using ADO objects or other ways. If
you want to see not only changes to the currently displayed records in the
forms but new records that has been added as well, then the Requery command
should be used instead of Refresh.

However, in your case, the use of either the Refresh or the Requery command
shouldn't be necessary; even when using the DoCmd.RunCommand acCmdSaveRecord
procedure. It if possible that your problem arises from something else.
 
If I try a simple "me.requery" I get a message indicating can't find the
field 'forms'... I had this same error when I had a trigger that appended
an identity field into another table with an identity field so I guess it
has something to do with that. I'll have to look further into what's
causing this.
 
I got it to work by setting the unique table property to table that's being
modified and the Resync Command.
 
Back
Top