none
MS Access application malfunctioning RRS feed

  • Question

  • My MS Access application malfunctioning, for example the Access VBA compiler returns false for this empty textbox condition: If (IsNull(txtFindText.Value)) Then

    And it cannot recognize a textboxes value property.

    Tuesday, March 14, 2017 9:29 AM

Answers

  • Is this on the development machine? If it's not, it might be a missing reference. You'd have to determine which references are missing and take steps to resolve those

    If it is on the development machine, then ou may have problems with your database. Make a copy, then do this:

    1. Compact the database
    2. Compile your code - from the VBA Editor click Debug - Compile. Fix any errors and continue doing this until the menuitem is disabled
    3. Compact again

    You may also need to Decompile your database. To do that, create a shortcut with this as the Target:

    "Full path to msaccess.exe" /decompile

    Run that shortcut, then open your database. Access will decompile it when opening the database. Run the 3 steps above after doing this.

    You may also need to create a new, blank database and import everything from the old database into that new one.

    Also be sure your Office and Windows installations are fully up to date.


    -- Scott McDaniel, Microsoft Access MVP

    • Marked as answer by MarcusKgosi Wednesday, March 15, 2017 9:29 AM
    Tuesday, March 14, 2017 10:28 AM

All replies

  • Is this on the development machine? If it's not, it might be a missing reference. You'd have to determine which references are missing and take steps to resolve those

    If it is on the development machine, then ou may have problems with your database. Make a copy, then do this:

    1. Compact the database
    2. Compile your code - from the VBA Editor click Debug - Compile. Fix any errors and continue doing this until the menuitem is disabled
    3. Compact again

    You may also need to Decompile your database. To do that, create a shortcut with this as the Target:

    "Full path to msaccess.exe" /decompile

    Run that shortcut, then open your database. Access will decompile it when opening the database. Run the 3 steps above after doing this.

    You may also need to create a new, blank database and import everything from the old database into that new one.

    Also be sure your Office and Windows installations are fully up to date.


    -- Scott McDaniel, Microsoft Access MVP

    • Marked as answer by MarcusKgosi Wednesday, March 15, 2017 9:29 AM
    Tuesday, March 14, 2017 10:28 AM
  • Hi Scott appreciate the help.

    Please explain your first sentence. What is a development machine and what is the menuitem you are referring to?


    • Edited by MarcusKgosi Wednesday, March 15, 2017 9:19 AM Added one more question to ask.
    Wednesday, March 15, 2017 5:56 AM
  • I am having trouble with step 2. My sub forms textbox is giving a "variable not defined" error?
    • Edited by MarcusKgosi Wednesday, March 15, 2017 8:39 AM Corrected error message
    Wednesday, March 15, 2017 8:17 AM
  • Sorry, I missed the email alert on this.

    The "development machine" is the computer where you did your development work. 

    The "menuitem" is the Compile menuitem on the Debug menu


    -- Scott McDaniel, Microsoft Access MVP

    Saturday, March 18, 2017 2:54 PM
  • These are the errors you must resolve. How you do that depends on the error. "Variable not defined" means what is says - there is a variable in your code that has not been defined (i.e. "Dimmed").

    You can avoid mistakes like that by always setting Option Explicit at the top of each VBA module. The VBA Editor also includes a default option for this:

    


    -- Scott McDaniel, Microsoft Access MVP

    Saturday, March 18, 2017 2:58 PM
  • This problem has returned again - code is not being obeyed. Decompiling not working and Compact and Repair.
    Friday, May 12, 2017 11:26 AM
  • Did you import everything to a new, blank database? Sometimes the "container" can become corrupt, and the only way to fix that is by moving everything to a new database.

    -- Scott McDaniel, Microsoft Access MVP

    Friday, May 12, 2017 2:06 PM
  • Yes I did that.
    Monday, May 15, 2017 6:43 AM
  • Is this happening on your development machine? Or on an enduser machine?


    -- Scott McDaniel, Microsoft Access MVP

    Monday, May 15, 2017 11:11 AM
  • Development machine
    Monday, May 15, 2017 12:23 PM
  • It appears you are trying to reference a textbox control called txtFindText on an open form. Is that correct? If so, then your code should be:

    If IsNull(Forms![YOUR FORM NAME]![txtFindText]) Then

    or if this code is running in a Private Sub on the open form itself you can use:

    If IsNull(Me.txtFindText) Then

    If the form is NOT open, ACCESS cannot reference the individual textbox control.

    Monday, May 15, 2017 5:36 PM
  • Sorry Lawrence, what I am referring to by "this problem has returned (or reoccurred) ..." is the malfunctioning of my Access application in general.

    When I brought up this code:

                    If IsNull(Me.txtFindText) Then

    It was the first time I had encountered this error, so, for that reason, I believed it had something to do with that line specifically. 

    Tuesday, May 16, 2017 6:37 AM
  • Are you having troubles with other databases as well? I ask because if you're having troubles with only one database, then the fault is most likely with that database. The only way to fix that is identify the problem component, and resolve that. Compact and Repair can sometimes do that, as can a Decompile/Compile/Import to New. If those don't resolve the issue, then sometimes the only answer is to create a new, blank database and import the objects one by one until you find one that fails to import. If you do, then you often must recreate that object.

    If you're having trouble with multiple databases, then the fault is often with your installation of Office or Windows. If so, then be sure that your Office and Windows are fully updated.


    -- Scott McDaniel, Microsoft Access MVP

    Tuesday, May 16, 2017 5:26 PM
  • The problem has gone away. I do not know how, all I know is I did this:

    Private Sub Form_Current()

        If (IsNull(Forms!Order!OrderSubform.Form!txtOrder_Number.Value) Or _
            Forms!Order!OrderSubform.Form!txtOrder_Number.Value = "") Then
                Forms!Order!OrderSubform.Form!txtDate_Of_Order.Enabled = True
                Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Enabled = True
        ElseIf (IsNull(Forms!Order!OrderSubform.Form!txtDate_Of_Order.Value) Or _
            Forms!Order!OrderSubform.Form!txtDate_Of_Order.Value = "") Then
                Forms!Order!OrderSubform.Form!txtDate_Of_Order.Enabled = False
                Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Enabled = True
                Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Value = True
        Else
            Forms!Order!OrderSubform.Form!txtDate_Of_Order.Enabled = True
            Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Enabled = False
            Forms!Order!OrderSubform.Form!chkbxOrder_Cancelled.Value = False
        End If

    End Sub

        
    Thursday, May 18, 2017 12:11 PM