Hi there,
I'm trying to use a pop up input box to set the reporting date for a number of queries, this is my code but instead of updating with the date I get what appears a calculation of dd/mm/yyyy...
ps some of you might recognise this code as it came from this site...thanks.
Mike
Sub selectdate()
Dim Message, Title, Default As String
Dim COBDate, MyValue As Date
On Error GoTo Errhdl
Message = "Enter Reporting COB Date (dd/mm/yyyy)"
Title = "InputBox Demo"
Default = IIf(Now() <> vbSunday Or vbSaturday, Date - 1, Date - 3)
COBDate = Format(InputBox(Message, Title, Default), "dd/mm/yyyy"
DoCmd.SetWarnings True
DoCmd.RunSQL "Update [TCOBDateOld] SET [RptDate] = " & [COBDate] & " Where [RecordID] = 'Y'"
DoCmd.SetWarnings True
Exit Sub
Errhdl:
MsgBox "Date Update Failed!"
Exit Sub
End Sub
I'm trying to use a pop up input box to set the reporting date for a number of queries, this is my code but instead of updating with the date I get what appears a calculation of dd/mm/yyyy...
ps some of you might recognise this code as it came from this site...thanks.
Mike
Sub selectdate()
Dim Message, Title, Default As String
Dim COBDate, MyValue As Date
On Error GoTo Errhdl
Message = "Enter Reporting COB Date (dd/mm/yyyy)"
Title = "InputBox Demo"
Default = IIf(Now() <> vbSunday Or vbSaturday, Date - 1, Date - 3)
COBDate = Format(InputBox(Message, Title, Default), "dd/mm/yyyy"
DoCmd.SetWarnings True
DoCmd.RunSQL "Update [TCOBDateOld] SET [RptDate] = " & [COBDate] & " Where [RecordID] = 'Y'"
DoCmd.SetWarnings True
Exit Sub
Errhdl:
MsgBox "Date Update Failed!"
Exit Sub
End Sub