Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

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

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
venkeykanle
Asked:
venkeykanle
  • 3
  • 3
  • 3
  • +2
3 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>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
 
GRayLCommented:
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
 
venkeykanleAuthor Commented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>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
 
venkeykanleAuthor Commented:
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
 
GRayLCommented:
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
 
GRayLCommented:
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
 
Mike EghtebasDatabase and Application DeveloperCommented:
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
 
Mike EghtebasDatabase and Application DeveloperCommented:
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
 
hnasrCommented:
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
 
venkeykanleAuthor Commented:
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
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
I object to the deletion.  Many excellent work-arounds were posted here.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now