473,386 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Storing text from a check box control

kobamfo
14
Hi Guys,
I have a check box named "jobstat" on a form and would like to store a text value in the backend table depending on the value of the "jobstat", so I have this code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub jobstat_AfterUpdate()
  2. Select Case Me![jobstat]
  3.   Case 1
  4.     Me![txtVal] = "Complete"
  5.   Case 0
  6.     Me![txtVal] = "Incomplete"
  7. End Select
the "txtVal" field on the form has its Visibility set to "No" and it is solely responsibly for collecting and committing the text "complete" or "incomplete" to the table.
Now the problem! the "Incomplete" works fine when "jobstat" is unchecked but when checked, the table field which has a data type of Yes/No which is also the Control Source for "txtVal" does not get the "complete" value, Why? What am I doing wrong or not doing?
Nov 9 '12 #1
2 1613
TheSmileyCoder
2,322 Expert Mod 2GB
The quick explanation is that the True or Yes in this case is represented as -1, not 1.

I suggest you look a bit at simple debugging. Adding a breakpoint @line 2 for instance, would allow you to check the value of me![jobstat] while hovering the mouse over the variable in the code. That would likely have helped you realise this yourself. Another option is to use Debug.Print or msgbox statements. These are quite usefull as well.
Nov 9 '12 #2
NeoPa
32,556 Expert Mod 16PB
How can that be true?

If a field is of type Yes/No then it is Boolean and is unable to take the String value of "Incomplete", whereas you indicate that it has. Something in what you say must be incorrect, and as such, is impossible to work with.

PS. I should have refreshed before posting. Smiley noticed another problem. The one you were trying to ask about. You should understand that VBA provides terms for True and False such that you can use the code :
Expand|Select|Wrap|Line Numbers
  1. Private Sub jobstat_AfterUpdate()
  2. Select Case Me![jobstat]
  3.   Case True
  4.     'Something that makes sense here
  5.   Case False
  6.     'Something that makes sense here
  7. End Select
Nov 9 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Marco Simone | last post by:
Hi, I have form with four text box controls. 3 text box controls are bound to table A, and 4 text box control sums values in this 3 text boxes with formula in Control source. txtBox4=++ If I...
6
by: MLH | last post by:
Runtime error 13 - type mismatch. I get the above error when I create a text box control on a form named and I run the following code in a sub on that same form... If DLookup("", "tblUsers",...
3
by: Nick Haines | last post by:
I need to write my own custom text edit control.. but I'm not sure where to start - I've never written a custom control... the features I want are somewhat similar to the VS .Net text editor - text...
0
by: Ken | last post by:
Is there any way I can easily set some text to bold in a rich text box control. prime example a CHAT GUI, i would like to set the user name bold. is this possible by doing so in the message...
4
by: Devhead | last post by:
i have an delphi application that i'm converting over into c#. one of the controls on one of my forms is a rich text control. the text is saved as html to an sql server db. is there a winform text...
2
by: Jim Haynes | last post by:
I cannot set the tab array for the Rich Text Box control. After I have text in the control, I try the following where rtb is the name of the rich text box control: rtb.selectall() Redim...
0
by: Sakharam Phapale | last post by:
Hi All, Is there any third party rich text box control which provides the fetures like left and right margine without changing the position of charatcters in control text like MS WORD. ...
2
by: walter | last post by:
Hi there, I'm wondering if it's possible to store the .net resource in database instead of resx file? Our site is a multi-lingual site ,storing text in resx file give us a burden on the website...
0
by: Paul_Madden via DotNetMonster.com | last post by:
I think this question could be answered in one word, either "No" or "Name-of- the-control". Am (still unfortunately :-)) having to use .NET 1.1 at work. Would like to display a simple text file...
0
by: ovaisrkhan | last post by:
I want to implement spell check control which will check spelling mistakes in text item and provide suggested words in case of mistakes. I urgent need soluion for this. Thanks Sham
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.