Invalid Expression - Repost

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Excuse the repost, but I still haven't found a solution for this.

I have inserted the following formula in my query

Monday:
IIf([Forms]![frmServiceReport]![cboReportType]=1,[Mon_Cpt],[Mon_Cpt]-[Mon])

I get a "MS Jet DB Engine does not recognize
[Forms]![frmServiceReport]![cboReportType] as a valid field name or
expression."

I used the formula wizard to build this. Any ideas on what is causing this?

Thanks,

Paul

p.s. The form is open. I am trying to read the bound column of a combo
box. I even tried switching to a text box and got the same error. There's
got to be somthing obvious I am overlooking, but darned if I can figure it
out.
 
Hi Paul,

the error message suggests that either:

1. frmServiceReport is not the name of the form you have open
2. there is not a control with the NAME property
cboReportType on that form


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
It does suggest that, but I used the wizard to create this clicking on forms,
loaded forms and selecting the control from the list and pasting it into the
formula.

My purpose was to avoid having two different record sources for this report.
I've given up on that for the mean time and am changing record sources by
referencing the same control in the On Open action of the report.

Paul


Crystal said:
Hi Paul,

the error message suggests that either:

1. frmServiceReport is not the name of the form you have open
2. there is not a control with the NAME property
cboReportType on that form


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com



Paul said:
Excuse the repost, but I still haven't found a solution for this.

I have inserted the following formula in my query

Monday:
IIf([Forms]![frmServiceReport]![cboReportType]=1,[Mon_Cpt],[Mon_Cpt]-[Mon])

I get a "MS Jet DB Engine does not recognize
[Forms]![frmServiceReport]![cboReportType] as a valid field name or
expression."

I used the formula wizard to build this. Any ideas on what is causing this?

Thanks,

Paul

p.s. The form is open. I am trying to read the bound column of a combo
box. I even tried switching to a text box and got the same error. There's
got to be somthing obvious I am overlooking, but darned if I can figure it
out.
 
Hi,


Are you using the query as record source, or through code with CurrentDb?
Access would recognize the syntax FORMS!FormName!ControlName, but Jet would
not.

For simplicity, we can generally say that Access is involved with a row
source property, a record source property, with Domains functions ( Dxxx ),
with the query designer, with the Access User Interface toolbars, or with
the DoCmd object; while Jet would be involved with CurrenDb or with
CurrentProject.Connection objects.



Hoping it may help,
Vanderghast, Access MVP
 
Is a crosstab query involved? If so, with a crosstab query you MUST declare
your parameters and if any
other queries are used in the crosstab their parameters must also be
declared.

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2

Watch out, Access sometimes helps by adding an extra set of [] around the
parameter.
[Forms]![frmServiceReport]![cboReportType] becomes
[[Forms]![frmServiceReport]![cboReportType]]


Paul Hammond said:
It does suggest that, but I used the wizard to create this clicking on
forms,
loaded forms and selecting the control from the list and pasting it into
the
formula.

My purpose was to avoid having two different record sources for this
report.
I've given up on that for the mean time and am changing record sources by
referencing the same control in the On Open action of the report.

Paul


Crystal said:
Hi Paul,

the error message suggests that either:

1. frmServiceReport is not the name of the form you have open
2. there is not a control with the NAME property
cboReportType on that form


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com



Paul said:
Excuse the repost, but I still haven't found a solution for this.

I have inserted the following formula in my query

Monday:
IIf([Forms]![frmServiceReport]![cboReportType]=1,[Mon_Cpt],[Mon_Cpt]-[Mon])

I get a "MS Jet DB Engine does not recognize
[Forms]![frmServiceReport]![cboReportType] as a valid field name or
expression."

I used the formula wizard to build this. Any ideas on what is causing
this?

Thanks,

Paul

p.s. The form is open. I am trying to read the bound column of a
combo
box. I even tried switching to a text box and got the same error.
There's
got to be somthing obvious I am overlooking, but darned if I can figure
it
out.
 
This is the code I used in the report, which works fine.

If Form_frmServiceReport.cboReportType = 2 Then
Me.RecordSource = "qryWeeklyReport NoPulls"
MsgBox "No Pulls - " &
Form_frmServiceReport.cboReportType.Column(1)
Else
Me.RecordSource = "qryWeeklyReport wPulls"
MsgBox "Pulls - " & Form_frmServiceReport.cboReportType.Column(0)
End If

I'd prefer to use the function in the query as earlier indicated. I hate to
have two queries where one would do.

Paul
--

Michel Walsh said:
Hi,


Are you using the query as record source, or through code with CurrentDb?
Access would recognize the syntax FORMS!FormName!ControlName, but Jet would
not.

For simplicity, we can generally say that Access is involved with a row
source property, a record source property, with Domains functions ( Dxxx ),
with the query designer, with the Access User Interface toolbars, or with
the DoCmd object; while Jet would be involved with CurrenDb or with
CurrentProject.Connection objects.



Hoping it may help,
Vanderghast, Access MVP

Paul Hammond said:
Excuse the repost, but I still haven't found a solution for this.

I have inserted the following formula in my query

Monday:
IIf([Forms]![frmServiceReport]![cboReportType]=1,[Mon_Cpt],[Mon_Cpt]-[Mon])

I get a "MS Jet DB Engine does not recognize
[Forms]![frmServiceReport]![cboReportType] as a valid field name or
expression."

I used the formula wizard to build this. Any ideas on what is causing
this?

Thanks,

Paul

p.s. The form is open. I am trying to read the bound column of a combo
box. I even tried switching to a text box and got the same error.
There's
got to be somthing obvious I am overlooking, but darned if I can figure it
out.
 
You win the prize. Yes it did have a crosstab as part of the query.

I had to fool program by leaving some brackets out of the parameter,
e.g. Forms]![frmServiceReport]![cboReportType and then Access filled in the
missing brackets. Otherwise I ran into invalid bracketing error that you
warned about.

Thanks a lot for your help.

Paul
--
Can't we all just get along?


John Spencer said:
Is a crosstab query involved? If so, with a crosstab query you MUST declare
your parameters and if any
other queries are used in the crosstab their parameters must also be
declared.

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2

Watch out, Access sometimes helps by adding an extra set of [] around the
parameter.
[Forms]![frmServiceReport]![cboReportType] becomes
[[Forms]![frmServiceReport]![cboReportType]]


Paul Hammond said:
It does suggest that, but I used the wizard to create this clicking on
forms,
loaded forms and selecting the control from the list and pasting it into
the
formula.

My purpose was to avoid having two different record sources for this
report.
I've given up on that for the mean time and am changing record sources by
referencing the same control in the On Open action of the report.

Paul


Crystal said:
Hi Paul,

the error message suggests that either:

1. frmServiceReport is not the name of the form you have open
2. there is not a control with the NAME property
cboReportType on that form


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com



Paul Hammond wrote:
Excuse the repost, but I still haven't found a solution for this.

I have inserted the following formula in my query

Monday:
IIf([Forms]![frmServiceReport]![cboReportType]=1,[Mon_Cpt],[Mon_Cpt]-[Mon])

I get a "MS Jet DB Engine does not recognize
[Forms]![frmServiceReport]![cboReportType] as a valid field name or
expression."

I used the formula wizard to build this. Any ideas on what is causing
this?

Thanks,

Paul

p.s. The form is open. I am trying to read the bound column of a
combo
box. I even tried switching to a text box and got the same error.
There's
got to be somthing obvious I am overlooking, but darned if I can figure
it
out.
 
Back
Top