A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Forms and Queries



 
 
Thread Tools Display Modes
  #11  
Old October 30th, 2007, 03:43 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default Forms and Queries

Now you know one reason that having spaces in field and table names is a bad
idea.

Try changing the line to
strCriteria = "[Billing Status] = """ & ctrl & """""


Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then

strCriteria = "[Billing Status] = """ & ctrl & """""

' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Please could you help as I seem to be doing something wrong. I have enter
the
code below and the following error appears. Syntax error (Missing
operator)
in query Expression (Billing Status =In Store (Off)""").

The Code is

Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Billing Status = """ & ctrl & """""
' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub

The Form Name is Billing Status Table and has a Field Name of Billing
Status
Which has a list below of
In Store (Off), Not In Store (On), Terminate.

The Query is also named Billing Status
The Report Name is Billing Status


"John Spencer" wrote:

Sorry, I am not sure I understand your latest set of questions.

I have no idea why you are getting the Invalid Operation, Please select
and
item from the List First message.

Are you selecting something in Combo1 before you ?click on a button? to
run
the report?
Did you drop the If ... Then ... Else ... End If structure in your code?

Private Sub ?????????????
Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo1

' make sure an item has been selected
' in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Available = """ & ctrl & """"
' Preview report filtered to selected availability
DoCmd.OpenReport "Status ", acViewPreview, WhereCondtion:=strCriteri
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If

End Sub

There is no such thing as a query form. Do you mean you want to filter
the
records that a form displays? OR do you want to filter the records that
a
query is displaying in Datasheet view?


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Hi John, Thanks it is working now but I have another Problem when I run
the
report I have a box with Invalid Operation Please select an item from
the
List First come up in front of the report. Sorry but I have another
question
how can I do the same but in a query form rather than a report form.

"John Spencer" wrote:

DoCmd.OpenReport "Status ", acViewPreview,
WhereCondtion:=strCriteria






  #12  
Old October 31st, 2007, 02:13 PM posted to microsoft.public.access.gettingstarted
Arlene
external usenet poster
 
Posts: 299
Default Forms and Queries

John Thanks for patience and Help and sorry for troubling you again but now
I have this error coming up.
Syntax error in string query Expression ([Billing Status] =In Store (Off)""").


"John Spencer" wrote:

Now you know one reason that having spaces in field and table names is a bad
idea.

Try changing the line to
strCriteria = "[Billing Status] = """ & ctrl & """""


Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then

strCriteria = "[Billing Status] = """ & ctrl & """""

' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Please could you help as I seem to be doing something wrong. I have enter
the
code below and the following error appears. Syntax error (Missing
operator)
in query Expression (Billing Status =In Store (Off)""").

The Code is

Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Billing Status = """ & ctrl & """""
' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub

The Form Name is Billing Status Table and has a Field Name of Billing
Status
Which has a list below of
In Store (Off), Not In Store (On), Terminate.

The Query is also named Billing Status
The Report Name is Billing Status


"John Spencer" wrote:

Sorry, I am not sure I understand your latest set of questions.

I have no idea why you are getting the Invalid Operation, Please select
and
item from the List First message.

Are you selecting something in Combo1 before you ?click on a button? to
run
the report?
Did you drop the If ... Then ... Else ... End If structure in your code?

Private Sub ?????????????
Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo1

' make sure an item has been selected
' in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Available = """ & ctrl & """"
' Preview report filtered to selected availability
DoCmd.OpenReport "Status ", acViewPreview, WhereCondtion:=strCriteri
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If

End Sub

There is no such thing as a query form. Do you mean you want to filter
the
records that a form displays? OR do you want to filter the records that
a
query is displaying in Datasheet view?


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Hi John, Thanks it is working now but I have another Problem when I run
the
report I have a box with Invalid Operation Please select an item from
the
List First come up in front of the report. Sorry but I have another
question
how can I do the same but in a query form rather than a report form.

"John Spencer" wrote:

DoCmd.OpenReport "Status ", acViewPreview,
WhereCondtion:=strCriteria







  #13  
Old October 31st, 2007, 02:26 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Forms and Queries

The original suggestion appears to have had one too many double quotes:

strCriteria = "[Billing Status] = """ & ctrl & """"

That's three double quotes before & ctrl &, and four double quotes after.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Arlene" wrote in message
news
John Thanks for patience and Help and sorry for troubling you again but
now
I have this error coming up.
Syntax error in string query Expression ([Billing Status] =In Store
(Off)""").


"John Spencer" wrote:

Now you know one reason that having spaces in field and table names is a
bad
idea.

Try changing the line to
strCriteria = "[Billing Status] = """ & ctrl & """""


Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then

strCriteria = "[Billing Status] = """ & ctrl & """""

' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Please could you help as I seem to be doing something wrong. I have
enter
the
code below and the following error appears. Syntax error (Missing
operator)
in query Expression (Billing Status =In Store (Off)""").

The Code is

Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Billing Status = """ & ctrl & """""
' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub

The Form Name is Billing Status Table and has a Field Name of Billing
Status
Which has a list below of
In Store (Off), Not In Store (On), Terminate.

The Query is also named Billing Status
The Report Name is Billing Status


"John Spencer" wrote:

Sorry, I am not sure I understand your latest set of questions.

I have no idea why you are getting the Invalid Operation, Please
select
and
item from the List First message.

Are you selecting something in Combo1 before you ?click on a button?
to
run
the report?
Did you drop the If ... Then ... Else ... End If structure in your
code?

Private Sub ?????????????
Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo1

' make sure an item has been selected
' in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Available = """ & ctrl & """"
' Preview report filtered to selected availability
DoCmd.OpenReport "Status ", acViewPreview,
WhereCondtion:=strCriteri
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If

End Sub

There is no such thing as a query form. Do you mean you want to
filter
the
records that a form displays? OR do you want to filter the records
that
a
query is displaying in Datasheet view?


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Hi John, Thanks it is working now but I have another Problem when I
run
the
report I have a box with Invalid Operation Please select an item
from
the
List First come up in front of the report. Sorry but I have another
question
how can I do the same but in a query form rather than a report form.

"John Spencer" wrote:

DoCmd.OpenReport "Status ", acViewPreview,
WhereCondtion:=strCriteria









  #14  
Old October 31st, 2007, 02:51 PM posted to microsoft.public.access.gettingstarted
Arlene
external usenet poster
 
Posts: 299
Default Forms and Queries

Douglas,

Thanks for your help as it is much appreciated.

Arlene

"Douglas J. Steele" wrote:

The original suggestion appears to have had one too many double quotes:

strCriteria = "[Billing Status] = """ & ctrl & """"

That's three double quotes before & ctrl &, and four double quotes after.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Arlene" wrote in message
news
John Thanks for patience and Help and sorry for troubling you again but
now
I have this error coming up.
Syntax error in string query Expression ([Billing Status] =In Store
(Off)""").


"John Spencer" wrote:

Now you know one reason that having spaces in field and table names is a
bad
idea.

Try changing the line to
strCriteria = "[Billing Status] = """ & ctrl & """""


Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then

strCriteria = "[Billing Status] = """ & ctrl & """""

' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Please could you help as I seem to be doing something wrong. I have
enter
the
code below and the following error appears. Syntax error (Missing
operator)
in query Expression (Billing Status =In Store (Off)""").

The Code is

Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Billing Status = """ & ctrl & """""
' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub

The Form Name is Billing Status Table and has a Field Name of Billing
Status
Which has a list below of
In Store (Off), Not In Store (On), Terminate.

The Query is also named Billing Status
The Report Name is Billing Status


"John Spencer" wrote:

Sorry, I am not sure I understand your latest set of questions.

I have no idea why you are getting the Invalid Operation, Please
select
and
item from the List First message.

Are you selecting something in Combo1 before you ?click on a button?
to
run
the report?
Did you drop the If ... Then ... Else ... End If structure in your
code?

Private Sub ?????????????
Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo1

' make sure an item has been selected
' in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Available = """ & ctrl & """"
' Preview report filtered to selected availability
DoCmd.OpenReport "Status ", acViewPreview,
WhereCondtion:=strCriteri
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If

End Sub

There is no such thing as a query form. Do you mean you want to
filter
the
records that a form displays? OR do you want to filter the records
that
a
query is displaying in Datasheet view?


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Hi John, Thanks it is working now but I have another Problem when I
run
the
report I have a box with Invalid Operation Please select an item
from
the
List First come up in front of the report. Sorry but I have another
question
how can I do the same but in a query form rather than a report form.

"John Spencer" wrote:

DoCmd.OpenReport "Status ", acViewPreview,
WhereCondtion:=strCriteria










  #15  
Old October 31st, 2007, 02:52 PM posted to microsoft.public.access.gettingstarted
Arlene
external usenet poster
 
Posts: 299
Default Forms and Queries

John,

Thanks for your help as it is much appreciated.

Arlene

"John Spencer" wrote:

Now you know one reason that having spaces in field and table names is a bad
idea.

Try changing the line to
strCriteria = "[Billing Status] = """ & ctrl & """""


Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then

strCriteria = "[Billing Status] = """ & ctrl & """""

' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Please could you help as I seem to be doing something wrong. I have enter
the
code below and the following error appears. Syntax error (Missing
operator)
in query Expression (Billing Status =In Store (Off)""").

The Code is

Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo200

' make sure an item has been selected in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Billing Status = """ & ctrl & """""
' Preview report filtered to selected Billing Status
DoCmd.OpenReport "Billing Status", acViewPreview, =strCriteria
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If
End Sub

The Form Name is Billing Status Table and has a Field Name of Billing
Status
Which has a list below of
In Store (Off), Not In Store (On), Terminate.

The Query is also named Billing Status
The Report Name is Billing Status


"John Spencer" wrote:

Sorry, I am not sure I understand your latest set of questions.

I have no idea why you are getting the Invalid Operation, Please select
and
item from the List First message.

Are you selecting something in Combo1 before you ?click on a button? to
run
the report?
Did you drop the If ... Then ... Else ... End If structure in your code?

Private Sub ?????????????
Const conMESSAGE = "Please select an item from the list first."
Dim strCriteria As String
Dim ctrl As Control

Set ctrl = Me.Combo1

' make sure an item has been selected
' in the combo box

If Not IsNull(ctrl) Then
strCriteria = "Available = """ & ctrl & """"
' Preview report filtered to selected availability
DoCmd.OpenReport "Status ", acViewPreview, WhereCondtion:=strCriteri
Else
MsgBox conMESSAGE, vbExclamation, "Invalid Operation"
End If

End Sub

There is no such thing as a query form. Do you mean you want to filter
the
records that a form displays? OR do you want to filter the records that
a
query is displaying in Datasheet view?


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Arlene" wrote in message
...
Hi John, Thanks it is working now but I have another Problem when I run
the
report I have a box with Invalid Operation Please select an item from
the
List First come up in front of the report. Sorry but I have another
question
how can I do the same but in a query form rather than a report form.

"John Spencer" wrote:

DoCmd.OpenReport "Status ", acViewPreview,
WhereCondtion:=strCriteria







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.