PC Review


Reply
Thread Tools Rate Thread

Is this code correct?

 
 
Ayo
Guest
Posts: n/a
 
      14th Jan 2008
Me!ProjectNumber.Format = "Text"

Can I use something like this to change a combobox's format from number to
text. My problem is I get an error message in the combobox telling me that I
am trying to enter a text in a numeric field. I figured if I change the
object's format right before I make the selection, than thevalue in the field
will will be recognized as a text data type.
Thanks

 
Reply With Quote
 
 
 
 
Al Campagna
Guest
Posts: n/a
 
      14th Jan 2008
Ayo,
The Format of a numeric field only applies to how a number is displayed,
and has no effect on the actual value.
You can not enter text into a numeric field. If you must... then the
field should be defined as text in your table design.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

"Ayo" <(E-Mail Removed)> wrote in message
news:B588F1A7-914A-4E55-8690-(E-Mail Removed)...
> Me!ProjectNumber.Format = "Text"
>
> Can I use something like this to change a combobox's format from number to
> text. My problem is I get an error message in the combobox telling me that
> I
> am trying to enter a text in a numeric field. I figured if I change the
> object's format right before I make the selection, than thevalue in the
> field
> will will be recognized as a text data type.
> Thanks
>



 
Reply With Quote
 
Ayo
Guest
Posts: n/a
 
      14th Jan 2008
Let me see if I can explain the situation better. I have a form with 2 ption
buttons and one combobox. The choice of the option button determines what is
avaliable for selection in the combobox.
If the user selects the project option button, the combobox have avaliable
project numbers, which are strictly number. If the user selects the Site
option button, the combobox have avaliable site numbers, which are
combination of numbers and letters, alphanumeric (or text).
When the form opens and I select the Site option first, everything works ok.
That means no errors to hang-ups, nothing. But if I select the project option
first, the is no problem when I make a selection in the combobox. The problem
and erroe arises whan I try to change my selection.
Lets say for instance I made a mistake by selecting the project option
button, or I changed my mind and decided that I wanted to run the site
option. If I now select the site option,after selecting the project option
and selected a project number in the combobox. If i now select the site
option and try o select the site ID number in the combobox, this is when I
get the error message and the program grid to an halt.
This is why I was hoping I could find a fix or a better way around this
problem that doesn't involve creating 2 comboboxes for either option.

"Al Campagna" wrote:

> Ayo,
> The Format of a numeric field only applies to how a number is displayed,
> and has no effect on the actual value.
> You can not enter text into a numeric field. If you must... then the
> field should be defined as text in your table design.
> --
> hth
> Al Campagna
> Microsoft Access MVP
> http://home.comcast.net/~cccsolutions/index.html
>
> "Find a job that you love... and you'll never work a day in your life."
>
> "Ayo" <(E-Mail Removed)> wrote in message
> news:B588F1A7-914A-4E55-8690-(E-Mail Removed)...
> > Me!ProjectNumber.Format = "Text"
> >
> > Can I use something like this to change a combobox's format from number to
> > text. My problem is I get an error message in the combobox telling me that
> > I
> > am trying to enter a text in a numeric field. I figured if I change the
> > object's format right before I make the selection, than thevalue in the
> > field
> > will will be recognized as a text data type.
> > Thanks
> >

>
>
>

 
Reply With Quote
 
rquintal@sympatico.ca
Guest
Posts: n/a
 
      14th Jan 2008
On Jan 14, 9:48*am, Ayo <A...@discussions.microsoft.com> wrote:
> Let me see if I can explain the situation better. I have a form with 2 ption
> buttons and one combobox. The choice of the option button determines what is
> avaliable for selection in the combobox.
> If the user selects the project option button, the combobox have avaliable
> project numbers, which are strictly number. If the user selects the Site
> option button, the combobox have avaliable site numbers, which are
> combination of numbers and letters, alphanumeric (or text).
> When the form opens and I select the Site option first, everything works ok.
> That means no errors to hang-ups, nothing. But if I select the project option
> first, the is no problem when I make a selection in the combobox. The problem
> and erroe arises whan I try to change my selection.
> Lets say for instance I made a mistake by selecting the project option
> button, or I changed my mind and decided that I wanted to run the site
> option. If I now select the site option,after selecting the project option
> and selected a project number in the combobox. If i now select the site
> option and try o select the site ID number in the combobox, this is when I
> get the error message and the program grid to an halt.
> This is why I was hoping I could find a fix or a better way around this
> problem that doesn't involve creating 2 comboboxes for either option.
>
>
>
> "Al Campagna" wrote:
> > Ayo,
> > * *The Format of a numeric field only applies to how a number is displayed,
> > and has no effect on the actual value.
> > * *You can not enter text into a numeric field. *If you must... then the
> > field should be defined as text in your table design.
> > --
> > * * hth
> > * * Al Campagna
> > * * Microsoft Access MVP
> > * *http://home.comcast.net/~cccsolutions/index.html

>
> > * * "Find a job that you love... and you'll never work a day in yourlife."

>
> > "Ayo" <A...@discussions.microsoft.com> wrote in message
> >news:B588F1A7-914A-4E55-8690-(E-Mail Removed)...
> > > Me!ProjectNumber.Format = "Text"

>
> > > Can I use something like this to change a combobox's format from number to
> > > text. My problem is I get an error message in the combobox telling me that
> > > I
> > > am trying to enter a text in a numeric field. I figured if I change the
> > > object's format right before I make the selection, than thevalue in the
> > > field
> > > will will be recognized as a text data type.
> > > Thanks- Hide quoted text -

>
> - Show quoted text -


Trying to Hide the problem by using a Format Statement instead of
fixing the code for the Combobox AfterUpdate event is not going to
help. Something in the Option Group's code is not working correctly,
please post it so we can together figure out what needs to be changed.

Q
 
Reply With Quote
 
Steve Schapel
Guest
Posts: n/a
 
      14th Jan 2008
Ayo,

No. As I have recently advised you elsewhere, this is not correct.

If you look at the drop-down list of possible entries for the Format
property of the combobox, you will see the pre-defined options
available. "Text" is not one of them.

As I advised you before, you could put like this:
Me!ProjectNumber.Format = ""

As I advised you before, in such a situation, I personally would use two
comboboxes, over the top of each other, and toggle their Visible
property, so that you see the one you want in response to the selection
in the Option Group. This will be easier.

We are assuming that the combobox is unbound.

--
Steve Schapel, Microsoft Access MVP

Ayo wrote:
> Me!ProjectNumber.Format = "Text"
>
> Can I use something like this to change a combobox's format from number to
> text. My problem is I get an error message in the combobox telling me that I
> am trying to enter a text in a numeric field. I figured if I change the
> object's format right before I make the selection, than thevalue in the field
> will will be recognized as a text data type.
> Thanks
>

 
Reply With Quote
 
Pat Hartman
Guest
Posts: n/a
 
      14th Jan 2008
It sounds like Access is making an assumption as to the data type of the
combo control based on the first selection. You may be able to get around
this by changing the RowSource query for the Project. Try the cStr()
function to convert the Project Number to a string.

Select cStr(ProjectNumber) as strProjectNumber From YourTable Order by
ProjectNumber;

"Ayo" <(E-Mail Removed)> wrote in message
news:C6F6363A-9C69-43BE-804B-(E-Mail Removed)...
> Let me see if I can explain the situation better. I have a form with 2
> ption
> buttons and one combobox. The choice of the option button determines what
> is
> avaliable for selection in the combobox.
> If the user selects the project option button, the combobox have avaliable
> project numbers, which are strictly number. If the user selects the Site
> option button, the combobox have avaliable site numbers, which are
> combination of numbers and letters, alphanumeric (or text).
> When the form opens and I select the Site option first, everything works
> ok.
> That means no errors to hang-ups, nothing. But if I select the project
> option
> first, the is no problem when I make a selection in the combobox. The
> problem
> and erroe arises whan I try to change my selection.
> Lets say for instance I made a mistake by selecting the project option
> button, or I changed my mind and decided that I wanted to run the site
> option. If I now select the site option,after selecting the project option
> and selected a project number in the combobox. If i now select the site
> option and try o select the site ID number in the combobox, this is when I
> get the error message and the program grid to an halt.
> This is why I was hoping I could find a fix or a better way around this
> problem that doesn't involve creating 2 comboboxes for either option.
>
> "Al Campagna" wrote:
>
>> Ayo,
>> The Format of a numeric field only applies to how a number is
>> displayed,
>> and has no effect on the actual value.
>> You can not enter text into a numeric field. If you must... then the
>> field should be defined as text in your table design.
>> --
>> hth
>> Al Campagna
>> Microsoft Access MVP
>> http://home.comcast.net/~cccsolutions/index.html
>>
>> "Find a job that you love... and you'll never work a day in your
>> life."
>>
>> "Ayo" <(E-Mail Removed)> wrote in message
>> news:B588F1A7-914A-4E55-8690-(E-Mail Removed)...
>> > Me!ProjectNumber.Format = "Text"
>> >
>> > Can I use something like this to change a combobox's format from number
>> > to
>> > text. My problem is I get an error message in the combobox telling me
>> > that
>> > I
>> > am trying to enter a text in a numeric field. I figured if I change the
>> > object's format right before I make the selection, than thevalue in the
>> > field
>> > will will be recognized as a text data type.
>> > Thanks
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating EventLog code, is this code correct? Jeff Microsoft C# .NET 1 15th Jul 2008 03:42 PM
Please correct for me this code Freeman_100 Microsoft Excel Programming 1 11th Apr 2006 08:37 PM
Please correct for me this code Freeman_100 Microsoft Excel Programming 0 11th Apr 2006 08:03 PM
Help to correct code Pat Microsoft Excel Programming 6 29th Dec 2004 05:02 PM
Correct SQL in Code Please Chipmunkwhiz Microsoft Access Queries 2 24th Feb 2004 06:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:54 PM.