Why Combo box default value returns 0 in form (1 Viewer)

Prakashpdl

New member
Local time
Today, 05:08
Joined
Apr 25, 2020
Messages
27
I have a Database design in which there are 4 forms linked to and updating a single table. In table I have set many fields as combo box with value list, and default value (Text), for example Yes and No with defalut value as Yes, Normal and Abnormal with default value as Normal etc. When I try to enter a new record, the form returns default value in numbers, 0 in some fields and -1 in other fields. I want the default text in form fields that I have set in table field. I could not find the way. Can u please help.
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:23
Joined
May 21, 2018
Messages
8,525
Booleans are stored -1 true, 0 false. You can format either the control or table field to show Yes/No True/False and i think even On/Off. Look at the format of the control to display what you want.
 

Prakashpdl

New member
Local time
Today, 05:08
Joined
Apr 25, 2020
Messages
27
Booleans are stored -1 true, 0 false. You can format either the control or table field to show Yes/No True/False and i think even On/Off. Look at the format of the control to display what you want.
I tried and it did not work.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:23
Joined
Oct 29, 2018
Messages
21,454
Can you post a sample copy of your db?
 

Prakashpdl

New member
Local time
Today, 05:08
Joined
Apr 25, 2020
Messages
27
Can you post a sample copy of your db?
I am posting the db. I have a log in form. On log in, it opens demography form. I click "add record" button, and enter new cleint ID and name etc. I save it and click "enter data for this client". It opens another form (History-frm) for this client, where default values are 0 and -1. The default values I set up in table are not shown here in this form. I want the default values exactly like that I set up in table design (Sez_tbl). Please help.
 

Attachments

  • ppp database -F4.zip
    2.2 MB · Views: 239

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:23
Joined
May 21, 2018
Messages
8,525
I cannot see what you are talking about. It all seems normal to me. I do not see any -1 and 0. Can you explain in more detail.

Default.jpg
 

Prakashpdl

New member
Local time
Today, 05:08
Joined
Apr 25, 2020
Messages
27
I cannot see what you are talking about. It all seems normal to me. I do not see any -1 and 0. Can you explain in more detail.
Thanks. The problem happens while data entry. If I directly open this form and go to new record, that (your screenshot) is what I see. But I need to start entering data from first form "demography" form, because this form has the identifier information for the clients. Once log in successful, it opens "demography" form.

Capture.PNG


Then I click "add record".

Capture2.PNG

I start entering new record in this form Then I save this data. I click "enter data for this client" button to navigate to "history form". Then it comes like this.

Capture3.PNG
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:23
Joined
May 21, 2018
Messages
8,525
Set inherit value list to false
Set limit to list = true
Get rid of any formatting
 

Prakashpdl

New member
Local time
Today, 05:08
Joined
Apr 25, 2020
Messages
27
Set inherit value list to false
Set limit to list = true
Get rid of any formatting
Did not work. I am still new in programming. I will be grateful if you could try and see if it works. Thanks
 

onur_can

Active member
Local time
Yesterday, 16:23
Joined
Oct 4, 2015
Messages
180
I tried it does not show any problem but
Would you try by setting the Show only row source values value to Yes.
 

onur_can

Active member
Local time
Yesterday, 16:23
Joined
Oct 4, 2015
Messages
180
It caught my attention now! You have defined your Yes / No fields as Short Text for Why. Shouldn't you define it as Yes / No?
Change the data type of yes / no fields in your table from short text to Yes / No and recreate your form, the problem will be fixed.
 
Last edited:

Prakashpdl

New member
Local time
Today, 05:08
Joined
Apr 25, 2020
Messages
27
It caught my attention now! You have defined your Yes / No fields as Short Text for Why. Shouldn't you define it as Yes / No?
Change the data type of yes / no fields in your table from short text to Yes / No and recreate your form, the problem will be fixed.
The problem is there not only for yes/no, when options are normal,abnormal and not known, default value is shown as 0. When I directly open form, there is no problem, default values are displyed exactly like what I put in table design. But when I open the form through another form, default values are not displayed properly.
 

onur_can

Active member
Local time
Yesterday, 16:23
Joined
Oct 4, 2015
Messages
180
I tried it on your vt. and I got a positive result. As you said, -1 and 0's came out. Yes or No fields appeared when I opened it later from the form.
 

Prakashpdl

New member
Local time
Today, 05:08
Joined
Apr 25, 2020
Messages
27
I tried it on your vt. and I got a positive result. As you said, -1 and 0's came out. Yes or No fields appeared when I opened it later from the form.
Can you please send me your modified file. I would like to learn from you what you did to make it work. Thanks
 

onur_can

Active member
Local time
Yesterday, 16:23
Joined
Oct 4, 2015
Messages
180
I deleted the file I was working on. But after I download and edit it again, I will add it here.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:23
Joined
May 21, 2018
Messages
8,525
See if this works.
 

Attachments

  • ppp databaseMajP.accdb
    1.1 MB · Views: 225

onur_can

Active member
Local time
Yesterday, 16:23
Joined
Oct 4, 2015
Messages
180
I made an example of 2 fields on your form and you can apply it to others.
It is due to your painting design being wrong. I created a table where you can use yes / no fields and linked it to the relevant fields. The number of options is not limited to Yes / No, you can add another option to this table at any time, such as Unknown
 

Attachments

  • ppp database_check arşivi.zip
    2.3 MB · Views: 159

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:23
Joined
Feb 19, 2002
Messages
43,233
4 forms linked to and updating a single table
Generally a bad idea. It looks like you have some repeating groups that should be child tables rather than columns in the main table. For example,
Other Illness
Past CNS Infection
Behavioral Problems
Intellect Disability
and I'm sure others that I can't see in the picture - are all medical problems. There could be hundreds of these and the ones that you are looking for could change over time. Each of these belongs as a row in a "medical problems" table rather than a column in your main table. When it comes time to be building reports and doing analysis, you will understand better the problem you are creating for yourself by using a spreadsheet-like flat structure rather than one that is properly normalized.
 

onur_can

Active member
Local time
Yesterday, 16:23
Joined
Oct 4, 2015
Messages
180
Yes, I also know that the design is not good. But the user does not want us to examine the design, he just talks about a negativity in his form. He wants the solution to this point. If it were up to me, I wouldn't design it that way.
 

Users who are viewing this thread

Top Bottom