>Thanks for your help.
>I have an error on this line : DbEngins(0)(0).Execute strSQL, dbFileOnError
[quoted text clipped - 14 lines]
>> End With
>> End Sub
Thank you,
I have the lines which follow but I have an error of variable on this
instruction "dbFileOnError".
I have this now
Private Sub Button_Click()
Dim strSQL As String
strSQL = "UPDATE [My Table]SET [Field Checkbox] = True"
With Me.MyForm.Form
If .Filter = "" Or .FilterOn = False Then
MsgBox "Form is not filtered"
Else
CurrentDb.Execute strSQL & " WHERE " & .Filter
End If
End With
End Sub
Is the procedure correct?
Yves
John W. Vinson a écrit :
>> Thanks for your help.
>> I have an error on this line : DbEngins(0)(0).Execute strSQL, dbFileOnError
[quoted text clipped - 25 lines]
>
> John W. Vinson [MVP]
John W. Vinson - 25 Dec 2007 17:13 GMT
>I have the lines which follow but I have an error of variable on this
>instruction "dbFileOnError".
oops!!!!
Should be
dbFailOnError
You want the query to "fail" (trigger an error which can be trapped). There's
no "file" involved.
Note that "I got an error" is of very little use to the volunteers here...
please specify the error message when you post to avoid the waste of a day in
getting your answer.
John W. Vinson [MVP]
Marshall Barton - 25 Dec 2007 17:20 GMT
>I have the lines which follow but I have an error of variable on this
>instruction "dbFileOnError".
[quoted text clipped - 10 lines]
>End With
>End Sub
Sorry about all the typos, If, and thanks to John for
spotting them.
You are now missing a space before the word SET, but because
ot the precedding ] I don't think it matters. Other than
that I don't see any syntax errors.
The use of CurrentDb instead of DbEngine(0)(0) is fine as
long as you do not have a use for the RecordsAffected
property. OTOH, since you removed the dbFailOnError
argument, I don't see how you can get an error message about
it. Maybe there's a scrap of code in another place that
caused the error?? Have you used the Debug - Compile menu
item to check for compile errors?

Signature
Marsh
MVP [MS Access]
If - 25 Dec 2007 19:54 GMT
Great thanks to you
Ok now it's fine
Private Sub Button_Click()
Dim strSQL As String
strSQL = "UPDATE [My Table]SET [Field Checkbox] = True"
With Me.MyForm.Form
If .Filter = "" Or .FilterOn = False Then
MsgBox "Form is not filtered"
Else
strSQL = strSQL & " WHERE " & .Filter
DBEngine(0)(0).Execute strSQL, dbFailOnError
End If
End With
End Sub
-------- Original Message --------
Subject: Re:Modify filtered results
From: Marshall Barton <marshbarton@wowway.com>
To:
Date: Tue Dec 25 2007 18:20:58 GMT+0100
>> I have the lines which follow but I have an error of variable on this
>> instruction "dbFileOnError".
[quoted text clipped - 25 lines]
> caused the error?? Have you used the Debug - Compile menu
> item to check for compile errors?