Page 1 of 1

Gah! Inconsistant QuDefine behaviour

Posted: Mon Jan 26, 2009 1:02 pm
by Steve Rowe
Sigh...
I've spent a while now writing some report building VBA that is based around the use of QUDefine. It's for use in the French office version, 64 bit 9.0 SP3 U9 server that I look after.
I built it on my laptop though for practical reasons. This is a UK office version, 32 bit 9.0 SP3 U9.

Guess what!
The stuff that I have built locally does not work in my live environment. With a copy of the dev server running in the live 64 bit environment the Qudefine statement that returns a true result in my local environment returns “Erreur 2015” in the French 64 bit environment.

I’m thinking there are 3 options as to the problem.
1. User error…
2. Differences in the French VBA environment to the English one.
3. Differences between the 63 bit and 32 bit versions of the software.

I’m pretty sure that I have done my testing in such a way that eliminates any possibility of option 1. Has anyone had any experience of option 2 or 3? Any other options that you might like to add? Anyone have further information in “Erreur 2015”, is it a straight VBA error or TM1?

I hate wasting time like this… gah! :evil:

Truncated code

Code: Select all

Option Explicit
Dim rngQuery As Range, ans As Variant, rngCol As Range, rngRowe As Range
Dim wksQuery As Worksheet, wksSA1 As Worksheet, server As String, cube As String, wksActive As Worksheet


Const QueryName = "zSA1query"


Sub Forum()


Dim ixSheet As Integer, rngCounter As Range, c As Range, rngEntity As Range

Set wksQuery = ThisWorkbook.Worksheets("Query Defn")
Set wksSA1 = ThisWorkbook.Worksheets("SA1")

server = wksQuery.Range("server")
cube = server & wksQuery.Range("Cube")

Set rngQuery = wksQuery.Range("QueryRange")
Set rngCol = wksSA1.Range("colValues")
Set rngRowe = wksSA1.Range("rowValues")
Set rngCounter = wksQuery.Range("Counter")
Set rngEntity = wksQuery.Range("Entity")

    'update query
    
    wksQuery.Calculate
    
    ans = Application.Run("Qudefine", cube, QueryName, rngQuery, "", "", "true", "false")
    'ans returns true on test system and Erreur 2015 on live system
    
    ans = Application.Run("QUSUBSET", cube, QueryName, "Management Information", QueryName)
    ans = Application.Run("QUSUBSET", cube, QueryName, "Sub-analysis 1", QueryName)


End Sub

Re: Gah! Inconsistant QuDefine behaviour

Posted: Mon Jan 26, 2009 3:47 pm
by Andy Key
Can you run any Application.Run() commands when written in English and executed in French?

Re: Gah! Inconsistant QuDefine behaviour

Posted: Mon Jan 26, 2009 5:12 pm
by Steve Rowe
Good try, somthing I had not thought of, but a DBRW in application.run form works.
cheers,

Re: Gah! Inconsistant QuDefine behaviour

Posted: Tue Jan 27, 2009 5:10 pm
by Steve Rowe
Just to update on this, I'm pretty sure the issue is nothing to do with QuDefine. I've just noticed that VBA seems to be ignoring change or skipping over particular lines of code.

It's very odd... As I step through the code a particular line will get ignored totally. It seems to be particularly bad on lines that I have just editted, sometimes even remembering the value that would have been assigned to a variable before the edit I had made.

This is preserved through restart of the excel session is happening on multiple different bits of VBA code. Obviously coding gets pretty hard if you can't rely on all your lines of script being executed.

Forcing a compile does not effect the issue either.

Other than needing to re-install office does anyone know if there is an option or smoething that might cause VBA to behave like this? It seems like the script is not getting compiled everytime the script is being run.

Excel 20003 SP2 ; Microsoft visual basic 6.3 (Retail 6.49972)
Cheers,

Re: Gah! Inconsistant QuDefine behaviour

Posted: Wed Jan 28, 2009 5:48 pm
by Andy Key
Excel 20003 SP2
I reckon it's because you are using a version of Excel that isn't due for release for another 17,994 years...

Re: Gah! Inconsistant QuDefine behaviour

Posted: Thu Jan 29, 2009 11:35 am
by mitch23
I have recently had exactly the same problem with QUDEFINE. It seemed as if the line of code was simply being ignored. Complete restart of Excel did not fix the issue. Then a couple of days later it magincally started working again. Go figure.

Re: Gah! Inconsistant QuDefine behaviour

Posted: Thu Jan 29, 2009 3:34 pm
by Steve Rowe
Mitch,
What version of VBA were using for interests sake?
Cheers,

Re: Gah! Inconsistant QuDefine behaviour

Posted: Fri Jan 30, 2009 12:40 am
by mitch23
6.5

Re: Gah! Inconsistant QuDefine behaviour

Posted: Tue Jun 23, 2009 7:15 pm
by mitch23
I think I just figured this out. It is not a VBA issue. If any of the elements are invalid, the function will fail silently and act like it just didn't execute. You can trap this by capturing the bollean return value into a variable. Returns true is successfully created the view and false if not.