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. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|