Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Access form Listbox displaying 0/-1 instead of Yes/No

Posted on 2008-06-13
14
Medium Priority
?
290 Views
Last Modified: 2013-12-25
Hello,

I have a peculiar problem.
Its related to MS Access 2003 and the .mdb file resides in a server.
I have a form which contains a list box and the list box is bound to a query. The query fetches records from tables. Two columns represents Yes/No field in the table.
When the application is run, two columns (out of several other columns) should display Yes/No.

The problem is, on some machines the list box column showing Yes/No and in some machines its displaying 0/-1.

Why is this unusual behavior?
0
Comment
Question by:venkeykanle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +2
14 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 168 total points
ID: 21781503
>When the application is run, two columns (out of several other columns) should display Yes/No.
Yes/No values are ultimately stored as -1 or 0 in tables.

Instead of your query having ColumnName1, ColumnName2, use ...
iif(ColumnName1=-1, "Yes", "No") as Column1, iif(ColumnName2=-1, "Yes", "No") as Column2

Then it will display as Yes or No in your list box.
0
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 168 total points
ID: 21782114
Change the query behind listbox1 to:

Select yn1, Format(yn1,"Yes/No") from myQuery;

Bound coumns 1
Number of columns2
Column Widths 0;.5"

this will produce the correct Yes/No string for the corresponding value of -1 or 0 in the field yn1
0
 

Author Comment

by:venkeykanle
ID: 21782131
If I directly run the query I get yes/no fields, because field data type is Yes/No.
As i mentioned some system produce Yes/No and some other 0/-1 !!!!
I could not figure out; may be some system settings would have caused so?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 66

Expert Comment

by:Jim Horn
ID: 21782153
>may be some system settings would have caused so?
In Table Design, click on your Yes/No fields, then in the lower left of your screen eyeball what's in the Format property.
0
 

Author Comment

by:venkeykanle
ID: 21782216
Field format is also Yes/No.
Another thing is that it was working fine for quite a long time. Recently it started giving problem (again not on all systems). Anything do with Access version/patch?
0
 
LVL 44

Expert Comment

by:GRayL
ID: 21782288
Probably, I had several inexplicable behavior changes recently to the point where I turned the auto updates off and now get the system to advise updates are ready to be installed.  I then get a chance to read up on what the update is about.  I'm still a bit confused.  Are you saying the results of your query display yes/no on some machines and others display -1,0?  You don't get both combinations in the same recordset?  In that case, displaying the Yes or No and storing the actual data as I showed you will cover all the bases.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 21782362
Did a bit more checking in the design view of the table and found you can set a number to integer or long, and set the format to Yes/No in the sub pane.  Similarly you can use True/False.
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 21783249
As it is has been mentioned before.

In the design view of the table select YEsNo field and then at the bottom, select Lookup. at "Display Control" select Cpmbo Box to have it displayed as Yes/No.

Mike
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 21783272
BTW, you may have to clear the combo box row source and start its row source again in case the field formats might have been copied to the row source differntly.
0
 
LVL 31

Expert Comment

by:hnasr
ID: 21784941
Yes/No = True/False = -1/0

On the form:Format Yes/No displays Yes/No
                             True/False displays  True/False
                           
<showing Yes/No and in some machines its displaying 0/-1.>
Compare the format of the text box on both machines.
0
 

Assisted Solution

by:venkeykanle
venkeykanle earned 164 total points
ID: 21838146
Hi all,
Sorry for the delay; held up doing some other assignment.
Any way, I got the solution.
The problem lies with the MS Access 2003 version. Access with 2003 SP3 has this issue (refer
http://support.microsoft.com/kb/945280). With SP3 'Yes/No' would display as '-1/0' (in listbox or combo)and this should be removed in query (record source for listbox or combo). Where as earlier version this works fine.

Thanks everybody who responded quickly.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 21838896
I object to the deletion.  Many excellent work-arounds were posted here.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question