I have create a function, in my module. and i'm Calling this function in a report by using a macro, in the menu which i have designed for my report.
now what this code is doing. when this code runs it change one of the field value to true in the table name as "order".
and then it inserts the current date and time in seprate fields, but my problem is that. ,
my code is not inserting the date in the proper format, i want the format like dd/mm/yy , but i'm getting mm/dd/yy ,
the table fields which i'm accessing by this code are as follows, Date field is set to medium date format,
time field is set to short time format,
here is the code
Function zayavactivadmin()
Dim dbs As Database
Dim O As Recordset
Dim title As String
Dim Mydate
Dim MyTime
Mydate = #1/1/1980#
Mydate = date$
MyTime = #4:35:17 PM# ' Assign a time.
MyTime = Time
title = "Backoffice"
Set dbs = CurrentDb
Set O = dbs.OpenRecordset("select * from Orders where OrderID=" & Forms!OrdersAdmin!OrderID, dbOpenDynaset)
If O!zayavflag = True Then
MsgBox ("You already have send this order"
, ,title
Exit Function
Else
O.edit
O!zayavflag = True
O!zayavDate = Mydate
O!zayavtime = MyTime
O.Update
O.Close
dbs.Close
End If
End Function
Please tell me where i'm wrong. thanks in advance.
now what this code is doing. when this code runs it change one of the field value to true in the table name as "order".
and then it inserts the current date and time in seprate fields, but my problem is that. ,
my code is not inserting the date in the proper format, i want the format like dd/mm/yy , but i'm getting mm/dd/yy ,
the table fields which i'm accessing by this code are as follows, Date field is set to medium date format,
time field is set to short time format,
here is the code
Function zayavactivadmin()
Dim dbs As Database
Dim O As Recordset
Dim title As String
Dim Mydate
Dim MyTime
Mydate = #1/1/1980#
Mydate = date$
MyTime = #4:35:17 PM# ' Assign a time.
MyTime = Time
title = "Backoffice"
Set dbs = CurrentDb
Set O = dbs.OpenRecordset("select * from Orders where OrderID=" & Forms!OrdersAdmin!OrderID, dbOpenDynaset)
If O!zayavflag = True Then
MsgBox ("You already have send this order"
Exit Function
Else
O.edit
O!zayavflag = True
O!zayavDate = Mydate
O!zayavtime = MyTime
O.Update
O.Close
dbs.Close
End If
End Function
Please tell me where i'm wrong. thanks in advance.