After spending probably two days with a form/subform that displays all the overdue clients in a listbox and as the user selects the > command button the clientname is removed from the listbox and appears to be inserted into the subform row.
The user can then print only those clients which are overdue as they wish. If they decide not to keep the newly added client on the subform, a < command button allows the user to re-add back to the listbox.
All that works except if the user tries to move back to the listbox an empty subform.
I get a Error 2427 and the line of code that it causes this is:
strClient = ""
strClient = strClient & "DELETE DISTINCTROW tblClientSelect.ClientID"
strClient = strClient & "WHERE ((tblClientSelect.ClientID=" & Forms![frmReminders]![frmClientSelected].Form![ClientID] & "
)"
Set MyQuery = dbCurrent.CreateQueryDef("", strClient)
MyQuery.Execute
MyQuery.Close
Me![frmClientSelected].Requery
If I add some error handling for cancel, I get the following error message:
Extra ] in query expression "((tblClientSelected.ClientID=))'
All I want to do is capture the error, provide appropriate code so that the user isn't aware that they are doing something wrong.
Also, I am using DateAdd to find records which are a year old from today's date. Is the correct function?
Angelique
The user can then print only those clients which are overdue as they wish. If they decide not to keep the newly added client on the subform, a < command button allows the user to re-add back to the listbox.
All that works except if the user tries to move back to the listbox an empty subform.
I get a Error 2427 and the line of code that it causes this is:
strClient = ""
strClient = strClient & "DELETE DISTINCTROW tblClientSelect.ClientID"
strClient = strClient & "WHERE ((tblClientSelect.ClientID=" & Forms![frmReminders]![frmClientSelected].Form![ClientID] & "
Set MyQuery = dbCurrent.CreateQueryDef("", strClient)
MyQuery.Execute
MyQuery.Close
Me![frmClientSelected].Requery
If I add some error handling for cancel, I get the following error message:
Extra ] in query expression "((tblClientSelected.ClientID=))'
All I want to do is capture the error, provide appropriate code so that the user isn't aware that they are doing something wrong.
Also, I am using DateAdd to find records which are a year old from today's date. Is the correct function?
Angelique