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

Help with date function

P: 1
Hello,

I'm new to Access and I have a form called Memo. In this memo I've a date field. I want that form to be linked to my switchboard, which I know how to do, and when the switchboad opens, the form memo will open if the date specify in the date field in the memo is equal to today.

How do I do that?

Thanks for any help!
Apr 18 '09 #1
Share this Question
Share on Google+
7 Replies


nico5038
Expert 2.5K+
P: 3,072
I'm no "switchboard fan", as there's a lot of flexibility in there you don't need at all. Personally I prefer to create my own main form ("frmMain") holding the buttons arranged in the way the users expect them.
On such a form I would "solve" your "Show the todays memo" by just adding a subform that's using a query filtering my table "tblMemo" for today's memo('s).

Thus always the actual memo is visible and even multiple when multiple have been entered. The user won't get extracted by a "jump" to another form and the pressing of the "Close" button to proceed with his/her actual task(s).

Getting the idea ?

The "Switchboard" solution would need to add VBA code to the OnOpen event of the Switchboard form and to check for a memo row for today.

Nic;o)
Apr 18 '09 #2

NeoPa
Expert Mod 15k+
P: 31,709
When opening the form [Memo] in the code from the Switchboard, simply specify a WhereCondition selecting only those records that match today's date :
Expand|Select|Wrap|Line Numbers
  1. strWhere = "[DateField]=Date()"
  2. Call DoCmd.OpenForm(FormName:="Memo", WhereCondition:=strWhere)
NB. As Date() is recognised within SQL it need not be passed as a literal string.

Welcome to Bytes!
Apr 18 '09 #3

missinglinq
Expert 2.5K+
P: 3,532
I'll echo all of Nic;o) and NeoPa's comments and add that if your form is actually named Memo you should change that name to something else, such as frmMemo, as Memo is a Reserved word in Access, and will probably trip you up, sooner or later.

Welcome to Bytes!

Linq ;0)>
Apr 20 '09 #4

FishVal
Expert 2.5K+
P: 2,653
"Memo" is not a reserved word in Access.

However giving names in Hungarian notation is considered to be a good programming style and, IMHO, aesthetically pleasing. :)

Name which starts from "frm" prefix makes evidence for you and for others looking at your code, that it refers to form object.
Apr 20 '09 #5

NeoPa
Expert Mod 15k+
P: 31,709
@FishVal
That seemed like a strange statement, so I looked for myself. Sure enough, it was listed as reserved (under "SQL Reserved Words" in Access 2003 help) :S
Apr 20 '09 #6

FishVal
Expert 2.5K+
P: 2,653
@NeoPa
Ok. My bad.
However I can't imagine situation when form name and SQL datatype could conflict.
Apr 20 '09 #7

NeoPa
Expert Mod 15k+
P: 31,709
@FishVal
To be fair though, I don't believe anyone was saying there might be. Simply (as you expressed well in your post) that it's a good idea to avoid using reserved words generally.

It's also a good idea for people to avoid embedded spaces in names as well as other punctuation characters. We tell them every time we get an opportunity to do so. Eventually some get it ;)
Apr 20 '09 #8

Post your reply

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