Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if Record has been Saved or Not 1

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I am trying to come up with a way to check if the record has been saved by the user.

OK, the user could have say 5 records when the form comes up. by pressing "next" and "previous" it will move them through the recordset. Now the user can only save one record at a time not the entire recordset. So after the user hits the save button I want to disable the save button. this lets the user know they have saved there changes to that record.

I am not sure how to really make this work correctly. I tryed to create a Text Box and Stamp the word "SAVED" into it..but you can see my problem with that.


any help would be appreciated

 
HI dvannoy,

this is quite not totally undestood.
So, a recordset with 5 records.
By pressing next and previous, the user chooses the record to save.
Where is this record saved?

After saving one record somewhere you want this record to still appear in the recordset or not?
->If yes and the recordset doesn't have equal values, then compare (each time the guy tries to save one record) the record he tries to save with all record previously saved.
If that record has already been saved, just desable the SAVE button.

Easy as that :)

-> If no (don't want this record to be repeated and so, to be deleted after the guy saves it, just erase it before saving it.So, no problem about enabling or not the 'SAVE' button.

===================
* Marta Oliveira *
===================
marta100@aeiou.pt
-------------------
IndraCPC
-------------------
Portugal
===================
 
Yes. the record will still appear after the user hits the Save Button. Compare with what?? the other records in the recordset?? Not going to happen since they have different data, the only thing thats makes them come togther in the same recordset is a Document Number. Compare with the DB??? I donot want to do that, these are fairly large forms I dont want to run a SQL statement to compare the data each time the user hits the save button.

 
At the end of the save process, disable the save button.
When a user makes a change in an edit box, enable the save button. Do this in the Text1.Change event.
Simple as that.
If the user clicks Next or Previous or Exits the form, check if the Save button is enabled. If so, then ask the user if they want to save before proceeding.


As an alternative, if you are working with bound controls (if you use disconnected or fabricated recordsets) you could use the ADO events, by declare your recordset object variable using WithEvents:

Option Explicit
Private WithEvents m_rsADO As ADODB.Recordset

Several ADO events are available to you now. In the code window's object list left drop-down, select m_rsADO.

In the right drop-down event list box select:
RecordChangeComplete.
In this event disable the Save button.

Then select the FieldChange event.
In this event make the save button enabled.

 
CCLINT,

OK...I see what your saying. how would I handle Checkboxes? since they have no Change event?

Thanks

 
Also, if a user hits Save and then I disable it..then if the person hits Next to move to the next record..I then enable the Save button but what if the user goes back to the record he just saved?? the save button would then be enabled right??

 
>..I then enable the Save button
No. You only enable it when the user makes a change.
You disable it when the user saves, or when the save action is to be cancelled because the user doesn't want to save the changes.


>since they have no Change event?
Checkboxes have a click event.

[Click] cmdSave.Enabled = True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top