Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Value gets missed (Access97)

    I have a form with text (can have list). If there is a value in the box - message should be displayed. If not - run Macro.

    If Forms![Update_master-data-charges]!txt_Check_Dates.Value = True Then
    MsgBox "Data for this Pay Period is exists in the master-data-charge table"

    Else
    DoCmd.RunMacro "Run_Update_master-data-charges"

    End If

    and it is showing Message value or no value.

    It seems like value in the box gets un-noticed.
    Please help

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Value gets missed (Access97)

    The Value property, as the name indicates, contains the value of the control. You are comparing this value with True or False. That doesn't make much sense. To find out whether a control has a non-blank value, you can use the IsNull function:

    If Not IsNull(Forms![Update_master-data-charges]!txt_Check_Dates) Then

    Note: if this code is in the module of Update_master-data-charges itself, you can use

    If Not IsNull(Me!txt_Check_Dates) Then

  3. #3
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value gets missed (Access97)

    Thanks, I actually changed it to lstbox and wrote
    If Not IsNull(Me!lst_Check_Dates.Column(0)) Then

    So your idea modified...TAHNKS

    I hope you proud of me))

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Value gets missed (Access97)

    Glad you worked it out yourself. If the Bound Column property of the list box is 1, you can omit the reference to Column(0) and simplify it to

    If Not IsNull(Me!lst_Check_Dates) Then

  5. #5
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value gets missed (Access97)

    I worked it out with your help but I twiked it.
    I will try bound the column (the cleaner the better, right?)
    THANKS so much

  6. #6
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Value gets missed (Access97)

    This is doesn't have to be answered, just curious...

    My lstbox is unbounded
    Row Source type is a Table/Query
    Row Sourse is a qry_App
    Bound Column 1

    However without Column(0) refferences it wouldn't work the code we discussed or I am missing something. Query has 1 column with 1 date only always...or should I change to Bound Column 0
    (if it counts from 0)...THANKS

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Value gets missed (Access97)

    The Bound Column property starts counting at 1 (1 = first column, etc.). The Column(n) property starts counting at 0 (0 = first column, etc.). The Bound Column specifies which column corresponds to the Value property of the list box. Since Value is the default property, Me!lst_Check_Dates is equivalent to Me!lst_Check_Dates.Value.

    So IsNull(Me!lst_Check_Dates) should be equivalent to IsNull(Me!lst_Check_Dates.Column(0))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •