Results 1 to 6 of 6
  1. #1
    Skarvion is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    13

    On Current Error Message

    Hi all,


    So I make in this one particular form, I made a new event on current that runs a simple code. But everytime I opened the form or change record, this error message pops up and doesn't run the code.
    Click image for larger version. 

Name:	Screenshot (8).png 
Views:	13 
Size:	18.5 KB 
ID:	23673
    This is the code that I used:

    Code:
    Private Sub Form_Current()    If ((Me.DateBox1.value <> Null) And (Me.DateBox2.value <> Null)) Then
            DateBox2_BeforeUpdate 0
        End If
    
    
        Select Case Me.StatusGroup.value
            Case 1
                Me.StatOpt1.Enabled = True
                Me.StatOpt2.Enabled = True
                Me.StatOpt3.Enabled = False
            Case 2
                Me.StatOpt1.Enabled = False
                Me.StatOpt2.Enabled = True
                Me.StatOpt3.Enabled = True
            Case 3
                Me.StatOpt1.Enabled = False
                Me.StatOpt2.Enabled = False
                Me.StatOpt3.Enabled = True
        End Select
    End Sub
    DateBox 1 and 2 are text box that use date format.

    In this code, the upper block runs a function that works normally by itself when the DateBox2 is updated. I'm just using the if statement to make sure the function has all its required value. The lower block, the statusgroup is a control group that has 3 radio buttons which is clearly named as StatOpt1 to 3. It should be noted that a similar code is used for the StatusGroup_after update event with a little tweak but it worked fine over there too. Both of these blocks is just to make it have a consistent display in the form. So I'm sure that this code itself is right.

    I've tried to use only 1 of the code block and removing the me. prefixes but with no result. Also I tried using on load event, but it still gives same error message except refering to on load instead on current.
    Can anyone help me?

    UPDATE:
    Apparently as I tried to tweak the other part of the form, the error seems to persist to ALL of the event procedure even the one that before I inserted this event procedure was working. I've tried by removing the code above just to make it work like it used to, but it gives the same error message.

    Thank you in advance.
    Last edited by Skarvion; 02-14-2016 at 08:01 AM. Reason: Bigger problem

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What is this supposed to accomplish?
    Code:
    If ((Me.DateBox1.Value <> Null) And (Me.DateBox2.Value <> Null)) Then
       DateBox2_BeforeUpdate 0
    End If
    I don't think you can use Null that way which is why they invented the IsNull() function.

  3. #3
    Skarvion is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    13
    That just used to call other event procedure that already worked, it's just to refresh the value within text boxes that is related with that procedure.
    The if statement is just to make sure all the required text boxes has values.

    Anyway, apparently the problem persist to all of the procedure that I already make before that had worked. This error seems to occur after I add that code and still there even when that code is that removed. So this will take a while for me to try to revert to previous state. I do remember this error message happened before too, but disappear by itself without me changing anything and before I started to realize that was a real problem. I will give an update after I try to change it back again.

    Thank you for your reply though, I appreciate it.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You could try a Compact and Repair to see if that fixes the issue. If not them maybe *importing* your db into a fresh, new db and see if the issue follows. The *importing takes maybe 2 minutes. I would also try commenting out the If...EndIf stuff as a test.

  5. #5
    Skarvion is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    13
    Quote Originally Posted by RuralGuy View Post
    You could try a Compact and Repair to see if that fixes the issue. If not them maybe *importing* your db into a fresh, new db and see if the issue follows. The *importing takes maybe 2 minutes. I would also try commenting out the If...EndIf stuff as a test.
    Thanks a lot, the compact and repair tool didn't work, but at least reimporting it worked, I was scared I need to redo it from scratch again since I already write a lot in vba. Just a question though, what do you think that is producing that error? I'm not sure whether that code I wrote caused it. I will try to avoid the problem.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I don't really know what might be causing your issue but backup...backup...backup will help here. It sounds line you are getting some sort of corruption. Here's a link that addresses that issue: http://allenbrowne.com/ser-25.html

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

Similar Threads

  1. Error Message: No Current Record
    By arlrodri in forum Reports
    Replies: 2
    Last Post: 06-05-2014, 07:02 AM
  2. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  3. Replace - No Current Record Message
    By tweety in forum Forms
    Replies: 15
    Last Post: 02-14-2013, 07:05 AM
  4. Information message on current event
    By justauser in forum Forms
    Replies: 5
    Last Post: 02-07-2012, 12:15 PM
  5. Replies: 8
    Last Post: 05-16-2011, 06:01 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