By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,469 Members | 2,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,469 IT Pros & Developers. It's quick & easy.

Access 97, runtime error 5

P: 7
I am using Access 97 on a Win XP platform. The following code is attached to the On Entry event. I have tried this in Access 2003 and it works but not in 97

Private Sub s_addcomments_Enter()
Dim varAA As String
varAA = Format(Now(), "dd mmm yyyy at hh:mm:ss AMPM")
Debug.Print varAA
End Sub

If I comment out the Format line there is no error. I do not understand this.

Thanks.
Dec 31 '06 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,186
You could try replacing the line with :
Expand|Select|Wrap|Line Numbers
  1. varAA = Format(Now(), "dd mmm yyyy at hh:nn:ss AMPM")
BTW It may also be worth renaming your String field (varAA) as strAA. Misleading prefixes are likely to cause you problems ;)
Dec 31 '06 #2

P: 7
You could try replacing the line with :
Expand|Select|Wrap|Line Numbers
  1. varAA = Format(Now(), "dd mmm yyyy at hh:nn:ss AMPM")
BTW It may also be worth renaming your String field (varAA) as strAA. Misleading prefixes are likely to cause you problems ;)
Thanks for pointing out the str. Coming from the main frame, var notation was for variable(my usage). I changed your notation for time format from hh:nn:ss to hh:mm:ss. I still get the runtime error -- "Invalid procedure call or argument". I cannot see the error.
Checked some other examples but the light still has not gone on.

Appreciate your comments and assistance.
Jan 1 '07 #3

NeoPa
Expert Mod 15k+
P: 31,186
Hard to say as I don't have Access97 here atm.
Try :
Expand|Select|Wrap|Line Numbers
  1. Format(Now(), "dd mmm yyyy \a\t hh:nn:ss AMPM")
just on the off-chance.
BTW var... generally refers to Variant data-type in VB/VBA rather than variable.
Jan 1 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.