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

Editing data in a form based on a recordset

Status
Not open for further replies.

Grieg

Technical User
Sep 13, 2002
20
GB
Hi,

I have a form on an Access 2000 database which displays a record from a table and on the form the controls (combo\text boxes) are locked to prevent the data being changed. When a button is pressed the controls are unlocked and the following code is used to take a copy of the record, load it into a record set and use this record set to re-populate the form.

I'm using this method so that if changes are made and the user presses a button cancel the changes to the data can be discarded (as the recordset data wouldn't be updated)

Problem is this code displays the data using the new recordset however it can't be edited via the form. Could anyone show me where I am going wrong?

Many thanks,
Grieg.

Dim rstFound As Recordset
Dim SQLprimer As String
SQLprimer = "Select * From tblMain WHERE [tblMain].[ID] = " & findID
Set rstFound = New ADODB.Recordset
rstFound.Open SQLprimer, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Set Forms("frmViewAppointment").Recordset = rstFound
 
Why not leave the controls unlocked and when the user selects the Cancel button, issue the command Me.Undo?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top