COMPILER WRONG !!!

P

PACALA_BA

Hi, WHAT is not clear, i am ready to EXPLAIN it.....
--------
cSQL = cSQL & ",I0." & gkII_cKRA_SKR..this CODE-LINE is in MODULE
--------
cSQL = cSQL & ",I0.".....when running CODE, the compiler DO-NOT see
the value of public constant gkII_cKRA_SKR = "LAB"...!!!!! WHY ????
-------------------------------------------------------------------------------
BIG-PROBLEM is this wrong-compiler-example
http://i34.tinypic.com/71sdq8.jpg ;

Here is the String cSQL not correctly created !!!!
The Compiler DO NOT SEE the value of gkII_cKRA_SKR !!!!!!!!!

public const gkII_cKRA_SKR = "LAB"
' cSQL = "SOME-STRING" ....the actual vlue
If (LN_FLD_SEL_CNT < 255) Then
cSQL = cSQL & ",I0." & gkII_cKRA_SKR ' <--- SEE NOTICE DOWN
LN_FLD_SEL_CNT = LN_FLD_SEL_CNT + 1
endif
NOTICE:
In the watches window, the line with RED arrows
cSQL = "SOME-STRING,I0." ..the WRONG-current value of cSQL
->> WITHOUT public const gkII_cKRA_SKR ("LAB") ,WHY ?????
Question:
In the watches window, the line with GREEN arrows
cSQL = cSQL & ",I0." & gkII_cKRA_SKR ..the current value of CODE-LINE is
"SOME-STRING,I0.,I0.LAB"...
Here is added "LAB", that is OK...!!!!!!!!!!, but only in WATCH-WINDOW

Resume:
Why is there DIFFERENCE between Compiler and DEBUG ???
*******************************************
than the string is used for an connection
Connection.Execute cSQL
and because the string cSQL is Wrong , execution failes.....
 
D

David W. Fenton

WHAT is not clear, i am ready to EXPLAIN it.....

You're using a piece of software to monitor what's going on and it's
not Access. This information is useless to us, and I'm not
interested in figuring out what it all means, nor in reading your
explanation of what it means.

You haven't shown anything at all as a compiler error, and we've not
seen the code that you say is compiling wrong, so are as I recall.

I don't have much interest in trying to wade through spaghetti posts
in order find out WTF you're trying to say. If you can't lay it out
clearly, then you're not going to get an answer.
 
P

PACALA_BA

Hi,
After Compile is all OK, NO-Errors (But it is NOT REALLY TRUE !!),
when executing SQL-string ,
comes an Error: ***Invalid syntax of SQL-String***,
because the Acces-System/Compiler
DO-NOT see the value of one public constant (=NullSting) !!!!,
but in Debugger/Watch IS the value of public constant ANOTHER (="LAB")
After 'PSEUDO-LINE-EDIT' (Value before and after the same) it is OK,
and runs Error-free over night (15 Hours).
I have NEVER seen such error !!!
Bye
(e-mail address removed)
(e-mail address removed)
 
D

David W. Fenton

After Compile is all OK, NO-Errors (But it is NOT REALLY TRUE !!),
when executing SQL-string ,
comes an Error: ***Invalid syntax of SQL-String***,
because the Acces-System/Compiler
DO-NOT see the value of one public constant (=NullSting) !!!!,

Why not use the built-in Access constant, vbNullString, instead?
Then you don't have to worry about defining your own constants.
but in Debugger/Watch IS the value of public constant ANOTHER
(="LAB") After 'PSEUDO-LINE-EDIT' (Value before and after the
same) it is OK, and runs Error-free over night (15 Hours).
I have NEVER seen such error !!!

I have no idea what the hell you are talking about here.

And you didn't post the code that you say is compiling wrong, so I
really can't suggest anything at all.

It looks to me as though you don't actually want any assistance as
you're making it as hard as possible for anyone to even comprehend
your supposed problem, let alone offer a suggested solution.
 
T

Tony Toews [MVP]

PACALA_BA said:
After Compile is all OK, NO-Errors (But it is NOT REALLY TRUE !!),

The compile did compile successfully. But you will still get runtime
errors which is what you have.
when executing SQL-string ,
comes an Error: ***Invalid syntax of SQL-String***,
because the Acces-System/Compiler
DO-NOT see the value of one public constant (=NullSting) !!!!,
but in Debugger/Watch IS the value of public constant ANOTHER (="LAB")
After 'PSEUDO-LINE-EDIT' (Value before and after the same) it is OK,
and runs Error-free over night (15 Hours).

Like David said. Post your code. Then we can tell you what the
problem is.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
P

PACALA_BA

Hi, the CODE is SIMPLE
My_public_const = "ABC"
strSQL = "SOME-STRING" & My_public_const
when running....
strSQL = "SOME-STRING" ...**MISSING** My_public_const, WHY ??
Debugger-Watch window....
strSQL = "SOME-STRING" & My_public_const...O.K.
 
P

PACALA_BA

Hi, In the CODE are NO-PROGRAMMERS-ERRORS (my Opinion)
This happens Allways, in 1-2 code-places (most case), sometimes over 10.
After Pseudo-line-edit (Before/After the same)
....it is ALL-OK
And Problem CODE is allways in ANOTHER-Code-Place
BIG-PROBLEM is this wrong-compiler-example
Here is the CORE of CODE....or something else missing ?
*****************************************
http://i34.tinypic.com/71sdq8.jpg ;

I can place the whole code here , but you will see Nothing ....(my Opinion)
There must be Something else WRONG...
 
C

Clif McIrvin

Pacala, did you understand the earlier reference to 'spaghetti
postings'? Your posts tend to be very incomplete fragments, and are
exceedingly difficult for anyone out here to make any sense of.

It would be very helpful if you could avoid the SHOUTING and provide a
beginning - to - end summary in one narrative.

I understand that you are hesitant to post your complete code, as it
sounds as though it is many thousands of lines in length.

Do I understand you to be saying that this code has been running
successfully for some time, and then begins to fail after you attempt a
(minor) modification and re-compile?
After Pseudo-line-edit (Before/After the same)
...it is ALL-OK

By this do you mean that you delete the line of code and replace it with
the identical code? Or do you mean something else? By ALL-OK, are you
saying that you get a run-time error on this line, but after your
"Psuedo-line-edit" this line executes without error? How do you know
this to be the case?
And Problem CODE is always in ANOTHER-Code-Place

Are you telling us that your run-time error doesn't always occur at the
same place?

1. If you run this code repeatedly (without any alteration at all) does
the run-time error stay exactly the same, or does it "move around"?

2. If you add a line of code, delete it, recompile and test what
happens?

3. Have you decompiled your mdb? Here is some information on decompiling
from Tony Toews:
http://www.granite.ab.ca/Access/decompile.htm
 
D

David W. Fenton

Hi, the CODE is SIMPLE
My_public_const = "ABC"
strSQL = "SOME-STRING" & My_public_const
when running....
strSQL = "SOME-STRING" ...**MISSING** My_public_const, WHY ??
Debugger-Watch window....
strSQL = "SOME-STRING" & My_public_const...O.K.
--------------
I am building allways the same MDE, with little changes
This is allways problem, but allways ANOTHER-CODE-PLACE...!!!???
I have implemented an TEST-RUN, because of this Annoying
errors....

Where is it that your strSQL does not have the value you expect?

That is, how are you detecting the "error"?
 
D

David W. Fenton

Hi, In the CODE are NO-PROGRAMMERS-ERRORS (my Opinion)

Well, none of us can say as we don't know what the code says.
This happens Allways, in 1-2 code-places (most case), sometimes
over 10. After Pseudo-line-edit (Before/After the same)
...it is ALL-OK
And Problem CODE is allways in ANOTHER-Code-Place
BIG-PROBLEM is this wrong-compiler-example
Here is the CORE of CODE....or something else missing ?
*****************************************
http://i34.tinypic.com/71sdq8.jpg ;

Again, this image IS COMPLETELY MEANINGLESS. It is not from Access,
it is from some tool that you are using to detect a "problem." The
problem may be with your detection tool, and not with the code, but
we can't say, since you aren't posting the code.
I can place the whole code here , but you will see Nothing ....(my
Opinion) There must be Something else WRONG...

Until you post the code, I'm done responding, as there's not a
damned thing I can offer to help unless I see *real* code (not the
pseudo code that you've posted).
 
P

PACALA_BA

Hi, today's CRAZY example....
error-code-line: SetOption "Left margin", "0.1"""
************************************
error: 2091 ,'' is an invalid name.
in Immediate window : NONE-ERRORS !!!!!!!
-------------------
After full-database-import
Compact & Repair
open-db (un-compiled, compile-on-demand = false)
error: 2091 ,'' is an invalid name.
error-code-line: SetOption "Left margin", "0.1"""
I DO-NOT UNDERSTAND such errors !!!
------------------
Public Function INI_AC_OPTIONS_PRT_MARGINS()
On Error GoTo XPAC_CHYBA: Dim lc__proc_meno$, lc__proc_ErrUSR$, ln__proc_err&
lc__proc_meno$ = "INI_AC_OPTIONS_PRT_MARGINS"
SetOption "Left margin", "0.1"""
SetOption "Right margin", "0.1"""
SetOption "Top margin", "0.1"""
SetOption "Bottom margin", "0.1"""
xPAC_KONIEC: Exit Function ' DATASHEET
XPAC_CHYBA:
ln__proc_err& = ERROR_SHOW(Err, lc__proc_meno$, lc__proc_ErrUSR$,
lkCurModul_NV)
Select Case ln__proc_err
Case 1: Resume
Case 2: Resume Next
Case Else: GoTo xPAC_KONIEC
End Select
End Function
----------------------------------------------------------------------------------
By this do you mean that you delete the line of code and replace it with
the identical code? ...YES, it seems un-believable, but than O.K.
--------------
After Psuedo-line-edit" this line executes without error? ..YES
--------------
1. If you run this code repeatedly (without any alteration at all) ..NO,
allways
LITTLE changes
--------------
2. If you add a line of code, delete it, recompile and test what
happens ?
3. Have you decompiled your mdb? Here is some information on decompiling
Allways NEW mdb created, than ExportasText/LoadAstext, and build MDE.
tha same errors, Only sometimes on the First TRY it is O.K
 
P

PACALA_BA

Hi, today's CRAZY example....
The WHOLE CODE is this LINE.......
error-code-line: SetOption "Left margin", "0.1"""
************************************
error: 2091 ,'' is an invalid name.
in Immediate window : NONE-ERRORS !!!!!!!
-------------------
After full-database-import
Compact & Repair
open-db (un-compiled, compile-on-demand = false)
error: 2091 ,'' is an invalid name.
error-code-line: SetOption "Left margin", "0.1"""
I DO-NOT UNDERSTAND such errors !!!
------------------
Public Function INI_AC_OPTIONS_PRT_MARGINS()
On Error GoTo XPAC_CHYBA: Dim lc__proc_meno$, lc__proc_ErrUSR$, ln__proc_err&
lc__proc_meno$ = "INI_AC_OPTIONS_PRT_MARGINS"
SetOption "Left margin", "0.1"""
SetOption "Right margin", "0.1"""
SetOption "Top margin", "0.1"""
SetOption "Bottom margin", "0.1"""
xPAC_KONIEC: Exit Function ' DATASHEET
XPAC_CHYBA:
ln__proc_err& = ERROR_SHOW(Err, lc__proc_meno$, lc__proc_ErrUSR$,
lkCurModul_NV)
Select Case ln__proc_err
Case 1: Resume
Case 2: Resume Next
Case Else: GoTo xPAC_KONIEC
End Select
End Function
 
P

PACALA_BA

Hi, today's CRAZY example....
This CODE-LINE
error-code-line: SetOption "Left margin", "0.1"""
************************************
error: 2091 ,'' is an invalid name.
in Immediate window : NONE-ERRORS !!!!!!!
-------------------
After full-database-import
Compact & Repair
open-db (un-compiled, compile-on-demand = false)
error: 2091 ,'' is an invalid name.
error-code-line: SetOption "Left margin", "0.1"""
I DO-NOT UNDERSTAND such errors !!!
 
D

David W. Fenton

AND THE CODE IS WRONG!!!!!!!!!!!!!!!!!

No wonder you get errors.

The format is
expression.SetOption(OptionName, Setting)
you want
printer.setoption "Left Margin", 0.1

Fix your code!!! STOP blaming the compiler for your stupidity.

And this is why we needed to see the code.
 
P

PACALA_BA

Hi, the same command
SetOption "Left margin", "0.1"""
while running..error, empty argument...WHY ?
in Immediate window(while code running) the same OK !!!!
and the same code-line in another databse build...OK !!!!, WHY ???

I do not have time for stupid Questions,
My MDB ( ~5MB, of text code, i wrote for 5 years, it was running
in Access 2000 wounderful, but now is there something WRONG, and it is really
ANNOYING such CRAZY errors !!!
 
P

PACALA_BA

OK, i can try it with printer

but the question is a have 10 another databases,
with this CRAZY-line , and it is O.K. WHY ????

this was an Error in ONLY ONE (WRONG) Database.
I does not have changed this line of code !!!!!
Todays build is O.K., Why ??????????

Hi, the same command
SetOption "Left margin", "0.1"""
while running..error, empty argument...WHY ?
in Immediate window(while code running) the same OK !!!!
and the same code-line in another databse build...OK !!!!, WHY ???

I do not have time for stupid Questions,
My MDB ( ~5MB, of text code, i wrote for 5 years, it was running
in Access 2000 wounderful, but now is there something WRONG, and it is really
ANNOYING such CRAZY errors !!!
 
P

PACALA_BA

Hi Vandal ,
i am Access user for 5 Years
before FoxPro for 5 years
My MDB ( ~5MB, of text code, i wrote for 5 years...)
It is dailly running over night 15 hours, error free

I do not have ANY time for stupid Questions,
*********************************

OK, i can try it with printer

but the question is a have 10 another databases,
with this CRAZY-line , and it is O.K. WHY ????

this was an Error in ONLY ONE (WRONG) Database.
I does not have changed this line of code !!!!!
Todays build is O.K., Why ??????????

Hi, the same command
SetOption "Left margin", "0.1"""
while running..error, empty argument...WHY ?
in Immediate window(while code running) the same OK !!!!
and the same code-line in another databse build...OK !!!!, WHY ???

I do not have time for stupid Questions,
*********************************
My MDB ( ~5MB, of text code, i wrote for 5 years, it was running
in Access 2000 wounderful, but now is there something WRONG, and it is really
ANNOYING such CRAZY errors !!!
 
P

PACALA_BA

Todays Problem

ln_Perm = IIf(bAllPerm, oPerm.AllPermissions, oPerm.Permissions)
? err, err.Description (function: ap_GetPermissions)
7,Out of memory
immediate window (while runnig) ...O.K. WHY ???

How can i check the Error, it is Really Out of memory ??
****************************************
When i ignore the error,and continue, all other is running O.K.
After database rebuild, **nothing changed*** NONE Errors, WHY ???
***************************************************

In the Task manager:
msAccess, MEMORY usage ~50MB
peak memory usage ~60MB
virtual memory ~40MB

ln_Perm = IIf(bAllPerm, oPerm.AllPermissions, oPerm.Permissions)
? err, err.Description (function: ap_CheckPermissions)
7,Out of memory
immediate window (while runnig) ...O.K. WHY ???

But i can step through the code ,ONLY THIS ONE command is err=7,...
ln_Perm = IIf(bAllPerm, oPerm.AllPermissions, oPerm.Permissions)

Full code of functions:
Function ap_GetPermissions(strUserName$, strObjectName$, eObjType As
eAP_ObjectType, Optional bNewObj As Boolean = False, Optional bAllPerm As
Boolean = True, Optional bRetOK As Boolean, Optional eDB As eDBEnum =
eDB__FILEName, Optional eDV_XXX As eDVEnum, Optional nDBTYPE As eDBTypeEnum =
EDB_CUR, Optional cDataBaseFullName$ = vbNullString, Optional nDBCounter As
eDBCounterEnum = eDBC_1, Optional cNote$ = "MSysDb, bAllPerm = (USER/GROUP)")
As Long
On Error GoTo XPAC_CHYBA: Dim lc__proc_meno$, strConnect$, lc_ObjName$,
lc_UserName$, lc_DBFile$, ll_ERR As Boolean, DB As DAO.Database, con As
DAO.Container, doc As DAO.Document, ln_Perm&, oPerm As Object, ln_Ret&,
strObjectType$: lc__proc_meno$ = "ap_GetPermissions": strObjectType =
EnumAP_ObjectType(eObjType): lc_DBFile = Nz(cDataBaseFullName): If
(Len(lc_DBFile) = 0) Then lc_DBFile = DDF_CURRENT
Set DB = DDF_GET_DB_REF(cDataBaseFullName:=lc_DBFile): lc_ObjName =
strObjectName: lc_ObjName = IIf(((Len(lc_ObjName) = 0) And (eObjType =
eApOType_DDF)), "MSysDb", lc_ObjName): Set con =
DB.Containers(strObjectType): con.Inherit = bNewObj: If bNewObj Then Set
oPerm = con
If Not bNewObj Then Set doc = con.Documents(lc_ObjName): Set oPerm = doc
lc_UserName = IIf((Len(strUserName) = 0), CurrentUser, strUserName):
oPerm.UserName = lc_UserName
ln_Perm = IIf(bAllPerm, oPerm.AllPermissions, oPerm.Permissions)
If Not DB Is Nothing Then DB.Close
xPAC_KONIEC: Set oPerm = Nothing: Set doc = Nothing: Set con = Nothing: Set
DB = Nothing: ap_GetPermissions = ln_Perm: bRetOK = (Not ll_ERR): Exit
Function
XPAC_CHYBA: ll_ERR = True: ln_Perm = -1: ERROR_RAISE lc__proc_meno, "Err: "
& Err & ", " & Err.Description & vbCrLf & "PROC: '" & lc__proc_meno & "'":
GoTo xPAC_KONIEC
End Function

Function ap_CheckPermissions(strUserName$, strObjectName$, eObjType As
eAP_ObjectType, fPerm As DAO.PermissionEnum, Optional bNewObj As Boolean =
False, Optional bAllPerm As Boolean = True, Optional bRetOK As Boolean,
Optional eDB As eDBEnum = eDB__FILEName, Optional eDV_XXX As eDVEnum,
Optional nDBTYPE As eDBTypeEnum = EDB_CUR, Optional cDataBaseFullName$ =
vbNullString, Optional nDBCounter As eDBCounterEnum = eDBC_1, Optional cNote$
= "MSysDb, bAllPerm = (USER/GROUP)") As Boolean
On Error GoTo XPAC_CHYBA: Dim lc__proc_meno$, ll_ERR As Boolean,
lc_ObjName$, lc_UserName$, ll_RET As Boolean, strConnect$, oPerm As Object,
ln_Perm&, lc_DBFile$, DB As DAO.Database, con As DAO.Container, doc As
DAO.Document, strObjectType$: lc__proc_meno$ = "ap_CheckPermissions":
strObjectType = EnumAP_ObjectType(eObjType): lc_DBFile =
Nz(cDataBaseFullName): If (Len(lc_DBFile) = 0) Then lc_DBFile = DDF_CURRENT
Set DB = DDF_GET_DB_REF(cDataBaseFullName:=lc_DBFile): lc_ObjName =
strObjectName: lc_ObjName = IIf(((Len(lc_ObjName) = 0) And (eObjType =
eApOType_DDF)), "MSysDb", lc_ObjName): Set con =
DB.Containers(strObjectType): con.Inherit = bNewObj: If bNewObj Then Set
oPerm = con
If Not bNewObj Then Set doc = con.Documents(lc_ObjName): Set oPerm = doc
lc_UserName = IIf((Len(strUserName) = 0), CurrentUser, strUserName):
oPerm.UserName = lc_UserName: ln_Perm = IIf(bAllPerm, oPerm.AllPermissions,
oPerm.Permissions): ll_RET = ((ln_Perm And fPerm) = fPerm): ll_RET =
IIf(((fPerm = dbSecNoAccess) And (ln_Perm <> dbSecNoAccess)), False, ll_RET):
If Not DB Is Nothing Then DB.Close
xPAC_KONIEC: Set oPerm = Nothing: Set doc = Nothing: Set con = Nothing: Set
DB = Nothing: ap_CheckPermissions = ll_RET: bRetOK = (Not ll_ERR): Exit
Function
XPAC_CHYBA: ll_ERR = True: ERROR_RAISE lc__proc_meno, "Err: " & Err & ", " &
Err.Description & vbCrLf & "PROC: '" & lc__proc_meno & "'": GoTo xPAC_KONIEC
End Function
 
D

Douglas J. Steele

Why bother asking us for advice if you're not going to take it?

Many different people have to you not to use the colon approach: to put no
more than one statement of code per line, and you persist in doing that.

Do you believe that making your code so difficult to read is going to make
your application smaller? You might be saving a few bytes by avoiding
carriage returns and line feeds, but it is not going to reduce your overall
size appreciably.
 
D

David W. Fenton

I do not have time for stupid Questions

I don't understand what you mean by that, as from where I sit, it's
*you* who has been asking stupid questions. If you can't answer
requests for clarifications from those who are trying to help you,
then you don't deserve their assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top