J
J. Trucking
Hello,
I am having a slight problem. I have a form/table which represents
various projects. This includes the project name, customer, etc. I
have a command button on this form in order to create an invoice for
the project (record) who is currently visible. When the user clicks
'Create an Invoice', a new form pulls up and asks the user what date
range they would like to specify for the invoice (to only collect
those hours worked during the date range). The user enters in a
'StartDate' and an 'EndDate' and then hits 'Okay'. Hitting 'Okay'
causes yet another new form to open (the invoice). To save the user
some time, I have coded the 'OnOpen' section of the Invoice Form to
have the default value of the 'Customer' and 'Project' to be that of
the first form. As well, the values of 'StartDate' and 'EndDate' on
the second form become the default values of the date range on the
invoice. The 'Customer' and 'Project' field are populated perfectly
but the dates keep getting screwed up and I'm not sure what I've
done. The code is as follows:
If CurrentProject.AllForms("frmInvoiceDateSelection").IsLoaded Then
Me![StartDate].DefaultValue = Forms![frmInvoiceDateSelection]!
[StartDate]
Me![EndDate].DefaultValue = Forms![frmInvoiceDateSelection]!
[EndDate]
End If
If I enter in 01/01/08 and 01/31/08 on 'frmInvoiceDateSelection' and
hit okay, the values of StartDate and EndDate on the Invoice both show
up as 12/30/1899. I checked the data type of the Invoice table for
both of the dates and they are both Short Date. This is the same on
the Invoice form. On 'frmInvoiceDateSelection' the StartDate and
EndDate fields are also Short Date with the Input Mask 00/00/00. If I
leave the dates blank, and hit 'Okay' on 'frmInvoiceDateSelection', I
get a Type Mismatch Error. Does anyone know where I could be going
wrong. I think it might be something pretty simple but for the life
of me, I just can't figure it out. Any help would be greatly
appreciated.
Thanks in Advance,
John
I am having a slight problem. I have a form/table which represents
various projects. This includes the project name, customer, etc. I
have a command button on this form in order to create an invoice for
the project (record) who is currently visible. When the user clicks
'Create an Invoice', a new form pulls up and asks the user what date
range they would like to specify for the invoice (to only collect
those hours worked during the date range). The user enters in a
'StartDate' and an 'EndDate' and then hits 'Okay'. Hitting 'Okay'
causes yet another new form to open (the invoice). To save the user
some time, I have coded the 'OnOpen' section of the Invoice Form to
have the default value of the 'Customer' and 'Project' to be that of
the first form. As well, the values of 'StartDate' and 'EndDate' on
the second form become the default values of the date range on the
invoice. The 'Customer' and 'Project' field are populated perfectly
but the dates keep getting screwed up and I'm not sure what I've
done. The code is as follows:
If CurrentProject.AllForms("frmInvoiceDateSelection").IsLoaded Then
Me![StartDate].DefaultValue = Forms![frmInvoiceDateSelection]!
[StartDate]
Me![EndDate].DefaultValue = Forms![frmInvoiceDateSelection]!
[EndDate]
End If
If I enter in 01/01/08 and 01/31/08 on 'frmInvoiceDateSelection' and
hit okay, the values of StartDate and EndDate on the Invoice both show
up as 12/30/1899. I checked the data type of the Invoice table for
both of the dates and they are both Short Date. This is the same on
the Invoice form. On 'frmInvoiceDateSelection' the StartDate and
EndDate fields are also Short Date with the Input Mask 00/00/00. If I
leave the dates blank, and hit 'Okay' on 'frmInvoiceDateSelection', I
get a Type Mismatch Error. Does anyone know where I could be going
wrong. I think it might be something pretty simple but for the life
of me, I just can't figure it out. Any help would be greatly
appreciated.
Thanks in Advance,
John