Runtime Error?

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I get: Runtime error 3075
Syntax error. in query expression '(select <> "")'

running the following segment of code:

strTemp = """"""
DoCmd.OpenReport "rpt#10Env", acViewPreview, , "Select <> " &
strTemp

I have other instances of similar use without any problems. The field
"Select" is a valid
field name in the report's RecordSource.

What am I missing?

Thanks,
Bill
 
Yes, Select is in fact a text field. I just this minute stumbled onto what
I needed to do:

DoCmd.OpenReport "rpt#10Env", acViewPreview, , "[Select] = ChrW(9658)"

Previously, I had attempted to skirt around any potential problems
that might be attributed to the fact that the "Select" text field contains
a Unicode character. As it turns out, Select had to be enclosed in
brackets, i.e., [Select].

I have another instance of the DoCmd.OpenReport that did not require
that the field name be in brackets:

strTemp = Me.[Registry.RegistryID]
DoCmd.OpenReport "rpt#6Env", acViewPreview, , "RegistryID = " & strTemp

I understand one's a text string and the other is a number (primary record
key) but
what difference does that make?

Bill
 
Select is reserved word in access (i.e. it understands it in other places
like select * from...) The square brackets make it implicit to use it as a
field.


Bill said:
Yes, Select is in fact a text field. I just this minute stumbled onto what
I needed to do:

DoCmd.OpenReport "rpt#10Env", acViewPreview, , "[Select] = ChrW(9658)"

Previously, I had attempted to skirt around any potential problems
that might be attributed to the fact that the "Select" text field contains
a Unicode character. As it turns out, Select had to be enclosed in
brackets, i.e., [Select].

I have another instance of the DoCmd.OpenReport that did not require
that the field name be in brackets:

strTemp = Me.[Registry.RegistryID]
DoCmd.OpenReport "rpt#6Env", acViewPreview, , "RegistryID = " & strTemp

I understand one's a text string and the other is a number (primary record
key) but
what difference does that make?

Bill

Rob Oldfield said:
Select is a text field?
 
That never occurred to me... of course!
Thanks,
Bill


Rob Oldfield said:
Select is reserved word in access (i.e. it understands it in other places
like select * from...) The square brackets make it implicit to use it as
a
field.


Bill said:
Yes, Select is in fact a text field. I just this minute stumbled onto
what
I needed to do:

DoCmd.OpenReport "rpt#10Env", acViewPreview, , "[Select] = ChrW(9658)"

Previously, I had attempted to skirt around any potential problems
that might be attributed to the fact that the "Select" text field
contains
a Unicode character. As it turns out, Select had to be enclosed in
brackets, i.e., [Select].

I have another instance of the DoCmd.OpenReport that did not require
that the field name be in brackets:

strTemp = Me.[Registry.RegistryID]
DoCmd.OpenReport "rpt#6Env", acViewPreview, , "RegistryID = " & strTemp

I understand one's a text string and the other is a number (primary
record
key) but
what difference does that make?

Bill

Rob Oldfield said:
Select is a text field?


I get: Runtime error 3075
Syntax error. in query expression '(select <> "")'

running the following segment of code:

strTemp = """"""
DoCmd.OpenReport "rpt#10Env", acViewPreview, , "Select <>
" &
strTemp

I have other instances of similar use without any problems. The field
"Select" is a valid
field name in the report's RecordSource.

What am I missing?

Thanks,
Bill
 
Back
Top