Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    hhuuhn is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Posts
    14

    No, this is a text field when the table created, although it is put with numbers.
    My other field code is not as complecated as this one, which is a simple condition, such as
    Private Sub anticoagulation_AfterUpdate()
    Me![DateOfStop].Enabled = Me![anticoagulation].Value = "0"
    Me![DateOfStop].Value = ""
    End
    this means if a patient didn't stop taking medicine, then no date of stopped.
    I really appreciate all of your time and help!

  2. #17
    hhuuhn is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Posts
    14
    Quote Originally Posted by RuralGuy View Post
    It looks to me like Change_smoking can *only* be 0,1 or 8. Is that true? Having fun answering two people at the same time?

    Yes, it is strictly controlled, no other choices. Also, one only can select one choice, and impossible to have two people's data mixed...

  3. #18
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If it is a Text field then why wouldn't this code work?
    Code:
    Private Sub change_smoking_AfterUpdate()
       If Me![change smoking] = "8" Then
          Me![Ceased smoking] = ""
          Me![Ceased smoking].Enabled = False
          Me![ReducedSmoking] = ""
          Me![ReducedSmoking].Enabled = False
          Me![IncreasedSmoking] = ""
          Me![IncreasedSmoking].Enabled = False
       Else
          Me![Ceased smoking] = ""
          Me![Ceased smoking].Enabled = True
          Me![ReducedSmoking] = ""
          Me![ReducedSmoking].Enabled = True
          Me![IncreasedSmoking] = ""
          Me![IncreasedSmoking].Enabled = True
       End If
    End Sub

  4. #19
    rommelgenlight is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2009
    Posts
    77
    on your very first message here on this forum, you said that this is a combo box. is the data on your combo box could be from a table? if so, what is the data type of your number 0,1,8 on your table?

  5. #20
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    A lot would depend on RowSourceType, RowSource, ControlSource and BoundColumn. Would you tell us what those values are please?

  6. #21
    hhuuhn is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Posts
    14
    Quote Originally Posted by rommelgenlight View Post
    if it is a number format base on your lookup table, then your change_smoking.value must be a number and not text format like what you've done such as "8", "1", "0". it should only be 8,0 or 1. and like i've said you cannot make ms access decide for itself what to choose between two values there in your OR statement. you should assign one value.
    Sorry, I think this is not let ms access to make choice, but to have wider choices, that means either "1" or"0" satisfys the condition it will be excuted. If only one value satisfy the condition, sure to assign one value.
    Here, my data question is smoking changed or not, if Yes, or No selected, then further question, ceased or redused smoking or increased smoking. NA mean never smoked, so it doesn't make sense to have ceased, redused, increased... VB code has this function.
    Also, I think here you talk data type as data format. Text type can have any kind of letters, numbers, signs, but numeric type only have number with some different format such as long, interger, simple, double etc.
    My data is text type for this field, even though number is put, this number doesn't have any meaning itself, only a definition is given then it make sense, it can not be calculated. 1 means Yes, 1 can also mean No, depanding on what meaning you assign to.

    Thank you very much for your time!

  7. #22
    hhuuhn is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Posts
    14

    Smile

    Quote Originally Posted by RuralGuy View Post
    A lot would depend on RowSourceType, RowSource, ControlSource and BoundColumn. Would you tell us what those values are please?
    This field has row source type: Table/Query
    Row Source: L_YN/NA ( looke up dable with two columns: Yes 1
    No 0
    NA 8
    controlSource: change smoking ( from the main table)
    Bound column: 2
    Here I made typo to bound column 1. I just changed to column 2 when i checked. Now it works
    Such a tiny typo made me crazy

    Thanks a million to help me find problem!

  8. #23
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Bingo! I knew we would get there eventually. Thanks for posting back with your success.

  9. #24
    rommelgenlight is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2009
    Posts
    77
    good to know its working now.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Variable Criteria
    By JamesLens in forum Queries
    Replies: 0
    Last Post: 01-02-2009, 04:55 PM
  2. Possible to store user-defined types in table?
    By Binky in forum Programming
    Replies: 0
    Last Post: 11-20-2008, 02:28 PM
  3. permision problem with access97
    By dourvas in forum Access
    Replies: 0
    Last Post: 11-04-2008, 06:07 AM
  4. Variable question
    By synapse5150 in forum Programming
    Replies: 1
    Last Post: 07-09-2008, 08:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums