Suggestions:
1. Change the name of the text box on the other from to (say) txtDate.
2. If txtDate is unbound (not bound to a date/time field), set the Format
property of the text box to Short Date or similiar, so it won't accept
non-date values.
3. Make sure you don't assign a non-date value to txtDate (e.g.
programmatically, or by its default value, etc.)
4. In your code, make sure the other form is open, and that txtDate contains
a valid date.
5. You may also want to check that Field1 is actually a time value without a
date, and that txtDate is a date without a time component.
This kind of thing:
If Me.Field1 Between #00:00:00# And #23:59:59# Then
If CurrentProject.AllForms("Form2").IsLoaded Then
If IsDate(Forms!Form2!txtDate) Then
Me.Field1 = DateValue(Forms!Form2!txtDate) + Me.Field1
End If
End If
End If
(The conditions there also elimnate nulls.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"DEI" <(E-Mail Removed)> wrote in message
news:3199E60D-5504-43BE-9CA2-(E-Mail Removed)...
>I have a form with fields for entry of times in short time format. I would
> like the user to enter only the 'short time' only, eg. '13:24', but then I
> would like to actually store the data in the underlying table with the
> complete date and time, eg. '7/24/2008 1:24 PM'.
>
> I have code in the after update event that adds the date to the time:
>
> Me.field1 = field1 + [Date]
>
> However, the [Date] is actually a date entered in a field on another open
> form that is an unbound control, in short date format. I sometimes get a
> 'type mismatch' error; the date entered in the unbound control is
> recognized
> as text and not a date.
>
> What is further problematic is that it does not always happen on all
> workstations, i.e some users get the error and others do not.
>
> Is there anything I can do to keep this from happenning?
>
> Thanks in advance.
>
> DEI