Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple problem with combo box (Access 2K, Win 2KPro, SQL Server 2K)

    I've searched a bit in the lounge and tried a few things and even think I've asked about this before, but here goes....

    I have a form with a combo box to use for finding records. there's a button that users can click to assign jobs to someone. the second form acts up a little if the user doesn't actually use the drop-down combo box to select a record, so i want to trap out cases where the combo box is 'empty' and prevent the second form from opening. setting a test to me.combo41.value = "" or IsNull doesn't do anything; I tried using Len and testing for 0, "", IsNull and haven't gotten any progress.

    any ideas?

    TIA

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

    Re: Simple problem with combo box (Access 2K, Win 2KPro, SQL Server 2K)

    From the way you state it, it's not quite clear whether you've tried

    If IsNull(Me.Combo41) Then

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple problem with combo box (Access 2K, Win 2KPro, SQL Server 2K)

    no, I didn't try that -- but I ended up changing the form that displays on the button click as the second sub-form was getting too confused. I deleted the second sub-form and added a button to have it show up, which prevented the issue with the form not working properly....

    Which brings me to another question: if the form you want to display doesn't have any info (it's a filtered form and there's no info when the filter's applied), is there a way to keep it from displaying? like not displaying a report if no data is found...

    The obvious solution here would be to run a SQL query in code, etc. before opening the form but I was wondering if there's any other slick way to do it.

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

    Re: Simple problem with combo box (Access 2K, Win 2KPro, SQL Server 2K)

    I don't think there's a slick way - you can use DCount or open a recordset to count the number of records that would be displayed, and not open the other form if the count is 0.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple problem with combo box (Access 2K, Win 2KPro, SQL Server 2K)

    thanks - i've implemented it the way I was thinking. i just recalled there was an option in reports to stop the display - the On No Data option in properties.

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

    Re: Simple problem with combo box (Access 2K, Win 2KPro, SQL Server 2K)

    Yes, reports have an On No Data event, but forms don't.

Posting Permissions

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