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 |
#1
|
|||
|
|||
Print From Form
I have a command button on a form to print a report. I want to pass a two items from the form to the report query but I can't seem to get the code right. This is what I have:
Private Sub cmdPrM1_Click() On Error GoTo Err_cmdPrM1_Click Dim stDocName As String stDocName = "VendMatl" DoCmd.OpenReport stDocName, acPreview, [ven_qte]![FGREF] = """ & Me.FGREF & """ And [ven_qte]![Name] = """ & Me.cbomsup1 & """ Exit_cmdPrM1_Click: Exit Sub Err_cmdPrM1_Click: MsgBox Err.Description Resume Exit_cmdPrM1_Click End Sub What am I missing? Thanks in advance. |
#2
|
|||
|
|||
Print From Form
On Fri, 4 Jun 2004 12:21:06 -0700, Bill wrote:
I have a command button on a form to print a report. I want to pass a two items from the form to the report query but I can't seem to get the code right. This is what I have: Private Sub cmdPrM1_Click() On Error GoTo Err_cmdPrM1_Click Dim stDocName As String stDocName = "VendMatl" DoCmd.OpenReport stDocName, acPreview, [ven_qte]![FGREF] = """ & Me.FGREF & """ And [ven_qte]![Name] = """ & Me.cbomsup1 & """ Exit_cmdPrM1_Click: Exit Sub Err_cmdPrM1_Click: MsgBox Err.Description Resume Exit_cmdPrM1_Click End Sub What am I missing? Thanks in advance. You're missing at least one comma. You placed your Where clause in the Filter argument position. DoCmd.OpenReport stDocName, acPreview, ,[ven_qte]![FGREF] = etc. You are also using a field named [Name]. Name is a reserved word in Access/VBA and should not be used as a field name. I would suggest ClientName, or txtName, etc. Is the datatype of the bound field of your combo box text (as written) or is the bound field a Number datatype? In which case you also have the syntax incorrect. Try it now. If you still have a problem, post back with an explanation of the Field and control datatypes involved in the where clause. -- Fred Please only reply to this newsgroup. I do not reply to personal email. |
#3
|
|||
|
|||
Print From Form
Thanks for straightening me out!
|
Thread Tools | |
Display Modes | |
|
|