Results 1 to 8 of 8
  1. #1
    Join Date
    May 2009
    Posts
    8

    Unanswered: setting flag to disable a button

    i have two buttons on a form. one button imports an excel spreadsheet, and one button auto categorizes the data that came into Access 2003 from the import. what i want to do is say if the auto categorize button was pressed, gray it out and when the import button is clicked, un gray it out. i was thinking of adding a field to a table and call it a flag field, but im not sure.

    Any help would be appreciated

    Valgore

  2. #2
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    no need for a flag, unless i misunderstand your post.
    in your click event for the autocategorize button, just buttonName.Enabled=False
    in the click event for your import button, buttonName.Enabled = True

  3. #3
    Join Date
    May 2009
    Posts
    8
    yeah. misunderstanding. let me back up a bit.
    my first button (Import) imports an American Express bill into Access. from there i have a button (AutoCategorize) that automatically inputs data into the bill table based on another table. the problem is, if someone presses this button twice, it overwrites some user inputted data. so i want to be able to stop the user from clicking the AutoCategorize button again. so here is an example.

    I import the bill for December. next, i press the AutoCategorize button and it does its things. i want to then have that button be disabled. when the next month comes around and i click the import button, i want the AutoCategorize button to be re-enabled so that the user can auto categorize again. and then immediately disable it again. does this make more sense?

    Valgore

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Use the flag field idea you first had.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    May 2009
    Posts
    8
    ok. im having trouble writing the code for this. any ideas?

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Code:
    If <FlagField> = True Then
       Me.ButtonToHide.Visible = False
    Else
       Me.ButtonToHide.Visisble = True
    End If
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    May 2009
    Posts
    8
    sorry for not responding sooner. our company was robbed and i lost my computer... so i can make a field in a table with a simple 0 in it correct? so if i use your code, how do i tell access to change the 0 to a 1 in the field? thats really what i need because if i dont have that, the flagfield will always be true.

    Valgore

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Huh? The flag field would be a yes/no field, which you can set in many ways. Me.FlagField = True or Me.FlagField = False for example.

    Perhaps I have misinterpreted your needs?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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