I have an update query (QryClearCompetitorDetails) which is used to re-set the data in a number of fields of a table (TblCompetitor)as follows:
Data is entered into this table via a form (FrmCompetitorData) which displays the details for a particular competitor.
I want to be able to re-set the data for a single record, using a command button, and have written the following code:
The problem is that each time, I receive a message asking if I want to re-set the data for all the records in the table.
Is there any way I should modify the code, or do I need to approach the problem in a totally different way?
Any help would be much appreciated
Best Regards
John
Code:
UPDATE TblCompetitor SET TblCompetitor.TxtName = Null, TblCompetitor.TxtInitials = Null, TblCompetitor.TxtRank_Rating = Null, TblCompetitor.TxtUnit = Null, TblCompetitor.fWRN = Null, TblCompetitor.TxtClass = Null, TblCompetitor.fWhiteheadInd = True, TblCompetitor.fRoupelInd = True, TblCompetitor.fFibuaInd = True, TblCompetitor.fWhiteheadTeam = True, TblCompetitor.fRoupelTeam = True, TblCompetitor.fFibuaTeam = True, TblCompetitor.fPetersPrize = Null
WITH OWNERACCESS OPTION;
Data is entered into this table via a form (FrmCompetitorData) which displays the details for a particular competitor.
I want to be able to re-set the data for a single record, using a command button, and have written the following code:
Code:
Private Sub ClearDetails_Click()
On Error GoTo Err_ClearDetails_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "QryClearCompetitorDetails"
DoCmd.OpenQuery stDocName, acNormal, acEdit
stLinkCriteria = "[LngCompetitorNo]=" & "'" & Me![LngCompetitorNo] & "'"
Exit_ClearDetails_Click:
Exit Sub
Err_ClearDetails_Click:
MsgBox Err.Description
Resume Exit_ClearDetails_Click
End Sub
The problem is that each time, I receive a message asking if I want to re-set the data for all the records in the table.
Is there any way I should modify the code, or do I need to approach the problem in a totally different way?
Any help would be much appreciated
Best Regards
John