Strange Issue

juneau730

Board Regular
Joined
Jun 7, 2018
Messages
111
Good day everyone, need to pick your brains on a strange Access vbscript issue I am having. I have two dBases, one original and one modification of the original.

I used all the same vbscripts macros from the original because they worked exactly how I need them. The modifications only include the additions of some queries and tabs.

Now, for some reason I am getting a Run-time error 424, Object Required in the mod version and I am not sure why, because it still works in the original. Debugger highlights the line I made bold/red.. Any thoughts on why this is happening in one dBase version, but not the other?

Code:
Private Sub cmdExport_Click()    Dim arrCurrentFormInfo
    Dim strCurrentForm
    Dim strCaption
    Dim strOutputFileName
    Dim strRecordSource
    Dim strOutputFile
    Dim objShell
    
    Set objShell = VBA.CreateObject("wscript.shell")
    
[B][COLOR=#ff0000]    arrCurrentFormInfo = Split(txtCurrentForm.Value, ":")[/COLOR][/B]
    If UBound(arrCurrentFormInfo) = 1 Then
        strCurrentForm = Replace(arrCurrentFormInfo(0), "form.", "")
        strOutputFileName = arrCurrentFormInfo(1)
    Else
        strCurrentForm = Replace(txtCurrentForm.Value, "form.", "")
        strOutputFileName = strCurrentForm
    End If
    'MsgBox txtCurrentForm
    
    strRecordSource = Me!NavigationSubform.Form.RecordSource
    'MsgBox strRecordSource


    strOutputFile = Application.CurrentProject.Path & "\" & strOutputFileName & ".xlsx"
    'DoCmd.OutputTo acOutputForm, frmCurrentForm, acFormatXLSX, Application.CurrentProject.Path & "\" & txtOutputFileName & ".xlsx", -1
    If Left(strRecordSource, 3) = "tbl" Then
        DoCmd.OutputTo acOutputTable, strRecordSource, acFormatXLSX, strOutputFile
    Else
        DoCmd.OutputTo acOutputQuery, strRecordSource, acFormatXLSX, strOutputFile
    End If
    
    'MsgBox strOutputFile
    Call FormatExcelSS(strOutputFile, "B1")
    objShell.Run "Excel.exe" & " " & Chr(34) & strOutputFile & Chr(34), , True
End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
If you are adding tabs maybe you have duplicated the names of the textboxes. Hard to say. Depends on what's in the new queries and tabs.

Note that txtCurrentForm is not qualified and I've not seen much code that isn't qualified. Normally, you'd write:
arrCurrentFormInfo = Split(Me.txtCurrentForm.Value, ":")
 
Last edited:
Upvote 0
If you are adding tabs maybe you have duplicated the names of the textboxes. Hard to say. Depends on what's in the new queries and tabs.

Note that txtCurrentForm is not qualified and I've not seen much code that isn't qualified. Normally, you'd write:
arrCurrentFormInfo = Split(Me.txtCurrentForm.Value, ":")

Hi, thanks for the information. I tried changing the code on the referenced line to your suggested code and it didn't fix the issue.

The new tabs/queries only filter out other data points based off the already imported master data set. An example of what I mean would be we audit user account inactive times, so one of the new tabs, queries the master data set for accounts with a last log on over 90 days, then puts those accounts on to a tab called Inactive 90 Days. So we aren't pulling "new" data only digging deeper into what we already have.
 
Upvote 0
It still depends on what is in the new tabs. Not the data really - the plumbing. For instance, if you made a mistake and gave a new control the same name as another existing control. Or some other mistake. It's such a vague error that it's not really possible to simply know what the problem is from the error description. I would be very interested in the control named txtCurrentForm. Is that in your new tab? is that in your old tab?
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top