Results 1 to 5 of 5
  1. #1
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88

    Need Textbox (when Dirty) to tic a box!

    I have code to tic a specific checkbox as soon as you click on the button (New) but if I enter a new record by typing on the textbox and not by using the (New) button the checkbox is never not ticked...I thought I was on the right tracked by doing the following but it doesn't work:

    Private Sub Games_AfterUpdate()
    If Dirty Then Do


    InCollection = True
    DoCmd.GoToRecord , , acNewRec
    End Sub

    I also tried a Form_Current() then me.games.enabled = false with a cmdNew_Click() with a me.games.enabled = TRUE when clicking on the button but I have to click the button twice to take the field out of FALSE.

    And I also tried FALSE as a default in the cmdNew_Click() code with an Else of TRUE.

  2. #2
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    Nevermind...the more I talked about here the more ideas I got and figured it out. This is how it worked for me. Instead of getting the textbox to tic the checkbox I disabled it until the NEW button was clicked. If you have an idea how to fix the original issue then let me know...

    Private Sub cmdNew_Click()
    Me.field.Enabled = False
    If DCount("field", "query or table") > 9 Then
    MsgBox "You have reached the 10 record limit."
    Cancel = True
    Else
    Me.field.Enabled = True
    DoCmd.GoToRecord , , acNewRec
    checkboxName = True

    End If
    End Sub
    Last edited by ortizimo; 08-10-2017 at 12:07 PM.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Why do you even need this checkbox? Can't you determine if a game is in collection with a query? Why a 10-record limit? Exactly what is purpose for this checkbox? If you need more assistance, might post db structure or even attach db to post.

    You have a textbox named 'field' or are you using generic substitutes in your code - why?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    i have a limit on it for testing purposes...i changed it to generic in case others might want to use it and not be confused if their newbies like I am. The problem is not after you have a record in the DB. Once theres one then when clicking on the New button the buttons then auto tics a checkbox for InCollection...(this is for my video game collection)...the issue is that the very first record can be input into the DB without clicking on the New button and just by typing the name of the game into the textbox but the checkbox is not ticked this way...I'm trying to prevent errors that entering a record through the textbox and not the New button is causing at this time.

  5. #5
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    What's the recordsource for the form? Why is the textbox blank before you click the New button? It should only be blank if there are NO records in the underlying table yet.
    We need to see a copy of your DB to understand your needs and to make communications clearer.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. On Dirty Propery
    By lonesoac0 in forum Forms
    Replies: 5
    Last Post: 05-16-2016, 08:24 PM
  2. Replies: 3
    Last Post: 07-22-2015, 04:37 PM
  3. me.dirty
    By slimjen in forum Forms
    Replies: 2
    Last Post: 03-28-2013, 01:51 PM
  4. On Dirty fires but Me.Dirty = False (v2010)
    By Rod in forum Programming
    Replies: 5
    Last Post: 07-30-2011, 08:42 PM
  5. Dirty
    By JEPEDEWE in forum Programming
    Replies: 1
    Last Post: 11-13-2010, 04:50 PM

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