A
Alain
Hi to all,
Can anyone explain to me why I am getting a compile error on the following
SELECT statement code:
Forms![Copy of frmOwnedProperties].RecordSource = CurrentDb.Execute_
"SELECT * FROM [Q-Properties(Active)] WHERE IdProperty = " & temp
the error I get is Expected: line number or label or statement or end of
statement
BTW, I am using this code to requery my form in the AfterUpdate event of my
combo to requery the form. my problem is when the user input a new value in
the combo that is not in the list, the NotInList event send me to the next
recordset when it is triggered, is this a normal situation ? Is there a
better way to keep the same recordset on screen after a new input in the
combo ??
Here is the code I use for the NotInList event
Private Sub Combo511_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not in the list "
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add to list or No to
not add to list."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new zoning?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblZoning", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!ZoningType = NewData
rs.update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Many thanks
Alain
Can anyone explain to me why I am getting a compile error on the following
SELECT statement code:
Forms![Copy of frmOwnedProperties].RecordSource = CurrentDb.Execute_
"SELECT * FROM [Q-Properties(Active)] WHERE IdProperty = " & temp
the error I get is Expected: line number or label or statement or end of
statement
BTW, I am using this code to requery my form in the AfterUpdate event of my
combo to requery the form. my problem is when the user input a new value in
the combo that is not in the list, the NotInList event send me to the next
recordset when it is triggered, is this a normal situation ? Is there a
better way to keep the same recordset on screen after a new input in the
combo ??
Here is the code I use for the NotInList event
Private Sub Combo511_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not in the list "
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add to list or No to
not add to list."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new zoning?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("tblZoning", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!ZoningType = NewData
rs.update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Many thanks
Alain