Solved

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

Posted on 2008-06-13
14
270 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 42 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 42 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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 30

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 41 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses
Course of the Month4 days, 6 hours left to enroll

630 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