Hi,
I have a field named OrderDate, which the user inputs Short Date (dd/mm/yyyy) from a textbox (DatePicker enabled).
Now in some condition, another field named CustomerUDD is empty (not specified/intended to be left blank). Now I am creating a button to fill the blank CustomerUDD to add 30 days from OrderDate (only for the blank CustomerUDD).
heres my code:
now the problem is, while the OrderDate are in a correct format(dd/mm/yyyy), the CustomerUDD sometimes messed up(changed the format to mm/dd/yyyy) which causes problem to the report. How can I solve this so the CustomerUDD does not use mm/dd/yyyy format, but instead using dd/mm/yyyy? I said sometimes, because sometimes it is in correct format, sometimes not. Why such inconsistency? Thanks
I have a field named OrderDate, which the user inputs Short Date (dd/mm/yyyy) from a textbox (DatePicker enabled).
Now in some condition, another field named CustomerUDD is empty (not specified/intended to be left blank). Now I am creating a button to fill the blank CustomerUDD to add 30 days from OrderDate (only for the blank CustomerUDD).
heres my code:
Code:
Dim defaultDate As Date
Dim CUDD As Date
Dim CustOrderID As Long
Dim insertDateQry As String
Dim ASAP As String
ASAP = "(ASAP)"
CustOrderID = Me.CustOrderIDBox.Value
defaultDate = DateAdd("d", 30, Me.OrderDate.Value)
insertDateQry = "UPDATE TblCustOrder SET CustomerUDD=#" & defaultDate & "#, ASAP='" & ASAP & "' WHERE CustOrderID=" & CustOrderID
If IsNull(DLookup("CustomerUDD", "TblCustOrder", "CustOrderID=" & CustOrderID)) Then
DoCmd.SetWarnings False
DoCmd.RunSQL insertDateQry
DoCmd.SetWarnings True
MsgBox ("Default date has been inserted (30 days from Order Date).")
End If
now the problem is, while the OrderDate are in a correct format(dd/mm/yyyy), the CustomerUDD sometimes messed up(changed the format to mm/dd/yyyy) which causes problem to the report. How can I solve this so the CustomerUDD does not use mm/dd/yyyy format, but instead using dd/mm/yyyy? I said sometimes, because sometimes it is in correct format, sometimes not. Why such inconsistency? Thanks