date function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
how can i use in date function?

the field type is date :
Me.date = date <---- i get null
also in here:
MsgBox "DATE - '" & date & "' " <<<

thanks.
 
That depends on where you are using it.
Is Me.date a control on your form? If so, that will cause problems
right off the bat. Date is a reserved word as it is the name of a
function. Naming ANYTHING in your project the same as such a reserved
word will cause problems. You should rename the control or field or
whatever that is.

Your usage of the Date function looks correct though.
 
thanks, I using in vb ,
i try to add () to the procedure but the program delete the brackets.
Private Sub CmdExecute_Click()
Me!date = date
MsgBox "DATE - '" & date () & "' " <<<
End Sub
 
Sorry, I did not assume that the actual field name was "date"... storrboy is
absolutely correct, and there are several 'reserved' words to avoid.
 
hi,
how can i use in date function?

the field type is date :
Me.date = date <---- i get null
also in here:
MsgBox "DATE - '" & date & "' " <<<

thanks.

Change the fieldname. Access is probably getting confused about whether you
mean the word "date" to refer to the fieldname Date, or the built-in function
Date().


John W. Vinson [MVP]
 
thanks, I using in vb ,
i try to add () to the procedure but the program delete the brackets.
Private Sub CmdExecute_Click()
Me!date = date
MsgBox "DATE - '" & date () & "' " <<<
End Sub

If there is a control named date - either rename it, or put it in brackets:

Me![date] = Date

Best to change both the control name and the fieldname though - Access *WILL*
(not may but will) get confused.

John W. Vinson [MVP]
 
it's not working;
I Change the fieldname: I get null when i update the filed and even in the
message

Me!Invoice_Date = date
sMyText = "Date " & date & ""
MsgBox sMyText
 
Did you change all occurances of it, not just this form?
Did the control name change to match the fieldname?
Did you change the ControlSource of the control to point to the new
field name?

In the VB editor go to the Debug menu and click on Compile
[PorjectName]. See what other errors occur and fix those.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top