J
JKlein
I have a form with many subforms. Upon updating a combo box these subforms
recordsources are set to a query that uses functions defined by text boxes
on the form. Occasionally I get an error that closes MS Access. If I
"comment out" the code in the combobox that resets the recordsource for the
subforms and place a command button with the "record sourcing" code I do not
get the error. Is there a difference in the way the code is executed?
Should it matter if the code is included in the combo box or the command
button?
Below is the code that is executed in the combox....gets errors. If I
comment it out in the combobox and execute it with a command button...no
error. Cant figure it out.
If I click the send error message to MS is there a way that MS can help with
the problem??
For cnt = FirstDay To ((DaysInMonth + FirstDay) - 1)
str_dayofmonth = fFormDate() + ((cnt - FirstDay))
Set frm = Forms!frm_CalendarNew.Controls("SF" & CStr(cnt)).Form
frm.RecordSource = "SELECT
MeetingId,MeetingDate,EmployeeFullName,ClientFullName,Starttime,Endtime FROM
tbl_TempCalendarData WHERE meetingdate = fdayofmonth()"
'Me.Controls("SF" & CStr(cnt)).Requery
If IsNull(cbo_ClientName) = False Then
frm.Controls("txb_name").ControlSource = "employeefullname"
End If
If IsNull(cbo_EmployeeName) = False Then
frm.Controls("txb_name").ControlSource = "clientfullname"
End If
frm.Controls("txb_time").ControlSource = "=Format([StartTime], 'h:mm
ampm') & ' - ' & Format([EndTime], 'h:mm ampm')"
Next
recordsources are set to a query that uses functions defined by text boxes
on the form. Occasionally I get an error that closes MS Access. If I
"comment out" the code in the combobox that resets the recordsource for the
subforms and place a command button with the "record sourcing" code I do not
get the error. Is there a difference in the way the code is executed?
Should it matter if the code is included in the combo box or the command
button?
Below is the code that is executed in the combox....gets errors. If I
comment it out in the combobox and execute it with a command button...no
error. Cant figure it out.
If I click the send error message to MS is there a way that MS can help with
the problem??
For cnt = FirstDay To ((DaysInMonth + FirstDay) - 1)
str_dayofmonth = fFormDate() + ((cnt - FirstDay))
Set frm = Forms!frm_CalendarNew.Controls("SF" & CStr(cnt)).Form
frm.RecordSource = "SELECT
MeetingId,MeetingDate,EmployeeFullName,ClientFullName,Starttime,Endtime FROM
tbl_TempCalendarData WHERE meetingdate = fdayofmonth()"
'Me.Controls("SF" & CStr(cnt)).Requery
If IsNull(cbo_ClientName) = False Then
frm.Controls("txb_name").ControlSource = "employeefullname"
End If
If IsNull(cbo_EmployeeName) = False Then
frm.Controls("txb_name").ControlSource = "clientfullname"
End If
frm.Controls("txb_time").ControlSource = "=Format([StartTime], 'h:mm
ampm') & ' - ' & Format([EndTime], 'h:mm ampm')"
Next