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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a record, current of recordset - Need some clarity!

Status
Not open for further replies.

smsmail

Programmer
Aug 11, 2010
105
US
Hello,

I am very confused (still somewhat a newbie) about how to make a record that displays on a form, the current record of the recordset. When I add/modify a record to a Recordset, I expected that record to become the current record. But, my assumptions were incorrect (i come from a mainframe background).

I am using ADO. When the form/program initially opens, it opens to a blank form. It opens using the code:
Code:
DoCmd.GoToRecord , , acNewRec

The program gives the user the option to add a record, by inputting data in the fields and clicking the add button.

If the user wants to modify or delete a record, the program allows the user to input selection criteria in specific fields on the form, then obtain the record the user wants to modify or delete using the "view" button. My program uses SQL code to obtain the records the user want to modify or delete. I am not using any methods to navigation (i.e. findfirst, movenext, etc) the recordset. I am using SQL.

My questions are:

1. When a record is obtained using SQL code and displayed on the form, is the record obtained, the current record in the recordset?

2. If not, how can I make the record current of the recordset?

3. Also, I want to display the oldvalue of a fields on the form when it has been updated. The oldvalue of the fields currently is NULL. I think this is occurring because the record that is displayed on the form, actually is not current in the recordset. Is this true?

Thanks in advance for your help and giving me some clarity on recordset currency.

smsmail
 
I think it is safe to say we need more information. You have not described your issue in a way that is clear to us how you are retrieving your data... You say you are using SQL... Sure but as a Recordsource for the form or as part of a recordset that you use to populate an unbound form?

Also, the Oldvalue property is volatile and is destroyed once the the record is committed. You could however log the values to a table, set them to global variables for temporary use, or assign them to unbound controls. In any case, you would do this on the BEFORE_UPDATE event.
 
The the thing that is unclearest of all is whether or not he is using a bound form, and why he is referring to "the program" and "my program".
 
This was actually answered already, and it did require lots of clarification. The OP posted the same thread in two forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top