user3471254
user3471254

Reputation: 1

Text box date is not formted as expected

i have written a vba code that populates a text box value
In vba code i have written some thing like this

dim  st_day as date
st_date  = format(date -7 , "m/dd/yyyy hh:mm")

and i have assinged this value to a textbox using me.textbox1
But the text box displaying a value as 03/21/2014 but what i am expecting is the text box
should display is 03/21/2014 00:00:00 AM .
can you kindly help me where i am worng ?

Upvotes: 0

Views: 62

Answers (1)

Sathish Kothandam
Sathish Kothandam

Reputation: 1520

Have u declared st_Date as date ..if so change the data type to variant ..

Something like this ..Tested

Sub tetetse()
Dim st_Date As Variant

st_Date = Format(Date - 7, "m/dd/yyyy hh:mm:ss AM/PM")

End Sub

Upvotes: 1

Related Questions