dbTalk Databases Forums  

Oddity with Combo Box in A2007

comp.databases.ms-access comp.databases.ms-access


Discuss Oddity with Combo Box in A2007 in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jbguernsey
 
Posts: n/a

Default Oddity with Combo Box in A2007 - 03-31-2010 , 11:10 AM






I have come across an odd problem in A2007. I have a small form with
a combo in it that I use to display a month from a query that shows
all 12 months in order. In a bit of code in the After Update event I
used Month(Date) for something (this is carried over from the earlier
A2003 version - which worked fine - that has been upgraded to A2007).

The code throws an error and I tried for ages (well, an hour maybe) to
find the problem. It turns out that Month(CDate(Date)) works fine
while Month(Date) does not. I have no idea why and am not going to
waste my time chasing reasons. I just hope this info might save
someone else the frustration I had to undergo ...

JB

ps If I'm being dense here please be gentle ...

Reply With Quote
  #2  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Oddity with Combo Box in A2007 - 03-31-2010 , 11:36 PM






On Wed, 31 Mar 2010 09:10:54 -0700 (PDT), jbguernsey
<jeff (AT) angelsystems (DOT) co.uk> wrote:

Just checking your (my?) density level: is "Date" the name of your
combobox?

-Tom.
Microsoft Access MVP


Quote:
I have come across an odd problem in A2007. I have a small form with
a combo in it that I use to display a month from a query that shows
all 12 months in order. In a bit of code in the After Update event I
used Month(Date) for something (this is carried over from the earlier
A2003 version - which worked fine - that has been upgraded to A2007).

The code throws an error and I tried for ages (well, an hour maybe) to
find the problem. It turns out that Month(CDate(Date)) works fine
while Month(Date) does not. I have no idea why and am not going to
waste my time chasing reasons. I just hope this info might save
someone else the frustration I had to undergo ...

JB

ps If I'm being dense here please be gentle ...

Reply With Quote
  #3  
Old   
jbguernsey
 
Posts: n/a

Default Re: Oddity with Combo Box in A2007 - 04-01-2010 , 01:00 AM



On Apr 1, 5:36*am, Tom van Stiphout <tom7744.no.s... (AT) cox (DOT) net> wrote:
Quote:
On Wed, 31 Mar 2010 09:10:54 -0700 (PDT), jbguernsey

j... (AT) angelsystems (DOT) co.uk> wrote:

Just checking your (my?) density level: is "Date" the name of your
combobox?

-Tom.
Microsoft Access MVP

I have come across an odd problem in A2007. *I have a small form with
a combo in it that I use to display a month from a query that shows
all 12 months in order. *In a bit of code in the After Update event I
used Month(Date) for something (this is carried over from the earlier
A2003 version - which worked fine - that has been upgraded to A2007).

The code throws an error and I tried for ages (well, an hour maybe) to
find the problem. *It turns out that Month(CDate(Date)) works fine
while Month(Date) does not. *I have no idea why and am not going to
waste my time chasing reasons. *I just hope this info might save
someone else the frustration I had to undergo ...

JB

ps *If I'm being dense here please be gentle ...
Hi Tom

No, I learned a sad lesson about reserved words many years ago!

The thing about this oddity is, the bit of code is in a Form Module
and won't work there - even msgbox Month(Date) throws an error whereas
if I put it into a function in a Code Module it's fine. There are no
References problems I can find and I've decompiled as well. Go
figure ...

JB

Reply With Quote
  #4  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Oddity with Combo Box in A2007 - 04-01-2010 , 08:23 AM



On Wed, 31 Mar 2010 23:00:18 -0700 (PDT), jbguernsey
<jeff (AT) angelsystems (DOT) co.uk> wrote:

You may have some form of corruption. You can export your form to text
(search for SaveAsText) and then import it again.

-Tom.
Microsoft Access MVP


Quote:
On Apr 1, 5:36*am, Tom van Stiphout <tom7744.no.s... (AT) cox (DOT) net> wrote:
On Wed, 31 Mar 2010 09:10:54 -0700 (PDT), jbguernsey

j... (AT) angelsystems (DOT) co.uk> wrote:

Just checking your (my?) density level: is "Date" the name of your
combobox?

-Tom.
Microsoft Access MVP

I have come across an odd problem in A2007. *I have a small form with
a combo in it that I use to display a month from a query that shows
all 12 months in order. *In a bit of code in the After Update event I
used Month(Date) for something (this is carried over from the earlier
A2003 version - which worked fine - that has been upgraded to A2007).

The code throws an error and I tried for ages (well, an hour maybe) to
find the problem. *It turns out that Month(CDate(Date)) works fine
while Month(Date) does not. *I have no idea why and am not going to
waste my time chasing reasons. *I just hope this info might save
someone else the frustration I had to undergo ...

JB

ps *If I'm being dense here please be gentle ...

Hi Tom

No, I learned a sad lesson about reserved words many years ago!

The thing about this oddity is, the bit of code is in a Form Module
and won't work there - even msgbox Month(Date) throws an error whereas
if I put it into a function in a Code Module it's fine. There are no
References problems I can find and I've decompiled as well. Go
figure ...

JB

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.