C
Charles D Clayton Jr
A2K
I have an unbound form that has 9 unbound textboxes. In the first one
a person enters a week ending date, the second a person picks from a
list of options and 3-9 the person enters a number. 3-9 represent days
of the week and not every day will have a number recorded. This is the
code that I am using (it works) and my question is, is this the most
efficient way to do this task. I take each day of the week and
determine if it has any data and if it does, then add that information
to the recordset, otherwise I do nothing. So I have 7 If-Then
statements. Everything works fine but I wanted to ask the newsgroup if
I should be doing this task differently.
'Add new records
With rst
If Me.txtSun <> "" Then 'only do if it has data
..AddNew
..Fields("id_CostCodes") = Me.cboCostCode
..Fields("hrsspent") = Me.txtSun
..Fields("dt") = Me.txtSun_6
..Update
End If
If Me.txtMon <> "" Then 'only do if it has data
..AddNew
..Fields("id_CostCodes") = Me.cboCostCode
..Fields("hrsspent") = Me.txtMon
..Fields("dt") = Me.txtMon_5
..Update
End If
Thanks,
Charles D Clayton Jr
I have an unbound form that has 9 unbound textboxes. In the first one
a person enters a week ending date, the second a person picks from a
list of options and 3-9 the person enters a number. 3-9 represent days
of the week and not every day will have a number recorded. This is the
code that I am using (it works) and my question is, is this the most
efficient way to do this task. I take each day of the week and
determine if it has any data and if it does, then add that information
to the recordset, otherwise I do nothing. So I have 7 If-Then
statements. Everything works fine but I wanted to ask the newsgroup if
I should be doing this task differently.
'Add new records
With rst
If Me.txtSun <> "" Then 'only do if it has data
..AddNew
..Fields("id_CostCodes") = Me.cboCostCode
..Fields("hrsspent") = Me.txtSun
..Fields("dt") = Me.txtSun_6
..Update
End If
If Me.txtMon <> "" Then 'only do if it has data
..AddNew
..Fields("id_CostCodes") = Me.cboCostCode
..Fields("hrsspent") = Me.txtMon
..Fields("dt") = Me.txtMon_5
..Update
End If
Thanks,
Charles D Clayton Jr