R
rebelscum0000
.....Because I do not understad it
I want to move my code to a module but I get a syntax error due the
Me.Dirty
Me.Dirty what? Invalid use of Me keyword
Forms![MainExclude_Form], Dirty or
Forms![MainExclude_Form]![Keyword].Dirty?
In addition, I set to If Me.Dirty Then Me.Dirty = True and too many
times is that correct?
This is in order to avoid Writing Conflicts
This is my code;
Private Sub Form_Open(Cancel As Integer)
Dim MyKeywordDeSe
Dim SQL1, SQL2 As String 'Select Query
Table
Dim Msg, Style, Title, Response, MySelection
On Error GoTo ErrorHandling
'Initialize Variables
MyKeywordDeSe = Forms![MainExclude_Form]![Keyword]
msg1 = "[ " & MyKeywordDeSe & "]" & " is your Default Search, Would you
Like to Change it?"
Style1 = vbYesNo + vbInformation 'Define buttons
Title1 = "Changing the Default Search" 'Define title.
If IsNull(MyKeywordDeSe) Then
Exit Sub
Else
Response = MsgBox(msg1, Style1, Title1)
If Response = 6 Then 'User chose Yes.
MySelection = "Yes" 'Perform some action.
This SQL Statement RESET Or DELETE All the Records from the field
MyKeyword OF THE 'Tbl MainExclude_Tbl
MsgBox "Reset your Default Key", vbOKOnly + vbInformation, "Deleting
Default Seach"
SQL1 = _
"UPDATE MainExclude_Tbl SET MainExclude_Tbl.MyKeyword = Null;"
If Me.Dirty Then Me.Dirty = False
CurrentDb.Execute SQL1, dbFailOnError
If Me.Dirty Then Me.Dirty = True
'This SQL Statement RESET Or DELETE All the Records from the field
MyAppz OF THE 'Tbl MainExclude_Tbl
SQL2 = _
"UPDATE MainExclude_Tbl SET MainExclude_Tbl.MyAppz = Null;"
If Me.Dirty Then Me.Dirty = False
CurrentDb.Execute SQL2, dbFailOnError
ElseIf Response = 7 Then 'User chose No.
MySelection = "No" 'Perform some action.
MsgBox "No Changes in your Default Search", vbOKOnly + vbInformation,
"Sa" & _
"ving Default Search"
Exit Sub
End If
End If
Exit Sub
ErrorHandling:
MsgBox "Numero Error: " & Err & " Descripcion " & Err.Description
End Sub
I want to move my code to a module but I get a syntax error due the
Me.Dirty
Me.Dirty what? Invalid use of Me keyword
Forms![MainExclude_Form], Dirty or
Forms![MainExclude_Form]![Keyword].Dirty?
In addition, I set to If Me.Dirty Then Me.Dirty = True and too many
times is that correct?
This is in order to avoid Writing Conflicts
This is my code;
Private Sub Form_Open(Cancel As Integer)
Dim MyKeywordDeSe
Dim SQL1, SQL2 As String 'Select Query
Table
Dim Msg, Style, Title, Response, MySelection
On Error GoTo ErrorHandling
'Initialize Variables
MyKeywordDeSe = Forms![MainExclude_Form]![Keyword]
msg1 = "[ " & MyKeywordDeSe & "]" & " is your Default Search, Would you
Like to Change it?"
Style1 = vbYesNo + vbInformation 'Define buttons
Title1 = "Changing the Default Search" 'Define title.
If IsNull(MyKeywordDeSe) Then
Exit Sub
Else
Response = MsgBox(msg1, Style1, Title1)
If Response = 6 Then 'User chose Yes.
MySelection = "Yes" 'Perform some action.
This SQL Statement RESET Or DELETE All the Records from the field
MyKeyword OF THE 'Tbl MainExclude_Tbl
MsgBox "Reset your Default Key", vbOKOnly + vbInformation, "Deleting
Default Seach"
SQL1 = _
"UPDATE MainExclude_Tbl SET MainExclude_Tbl.MyKeyword = Null;"
If Me.Dirty Then Me.Dirty = False
CurrentDb.Execute SQL1, dbFailOnError
If Me.Dirty Then Me.Dirty = True
'This SQL Statement RESET Or DELETE All the Records from the field
MyAppz OF THE 'Tbl MainExclude_Tbl
SQL2 = _
"UPDATE MainExclude_Tbl SET MainExclude_Tbl.MyAppz = Null;"
If Me.Dirty Then Me.Dirty = False
CurrentDb.Execute SQL2, dbFailOnError
ElseIf Response = 7 Then 'User chose No.
MySelection = "No" 'Perform some action.
MsgBox "No Changes in your Default Search", vbOKOnly + vbInformation,
"Sa" & _
"ving Default Search"
Exit Sub
End If
End If
Exit Sub
ErrorHandling:
MsgBox "Numero Error: " & Err & " Descripcion " & Err.Description
End Sub