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
|
|||
|
|||
View/Print Individual Reports
The report is there. I can open it manually from the navigation pane. I can
create a button that opens it with every record displayed. When using the code you supplied, I have tried the report title with and without spaces (it has spaces the way it is written on the report itself). For some reason, I get an error saying it doesn't exsist or that the name is misspelled (it is not) and an option to debug. When it opens the debug screen, everything looks like it should. "Duane Hookom" wrote: If the error suggested the report doesn't exist, what do you have to say about that? -- Duane Hookom MS Access MVP "Steve" wrote in message ... The ID field is an autonumber generated by access. I was trying to do this via macro. I realised what you put down there is code, so I went at it that way, and what I get when I press the button is an error message that says the report doesn't exsist. Do you know of a good reference site for setting this up step by step? "Duane Hookom" wrote: Are you actually using code or a macro? You mention "Action arguments" but this doesn't sound like code. Is the ID field numeric or text? -- Duane Hookom Microsoft Access MVP "Steve" wrote: Yes it is. "Duane Hookom" wrote: Is the ID field included in the Report's record source query? -- Duane Hookom Microsoft Access MVP "Steve" wrote: I'm entering that in the "Where condition" of the "Action arguments" section. And keep getting the message that "Access can't parse the expression". My primary key is "ID" the table is "Progress Notes" and the report is "Progress Notes" Below is how I entered the info: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere Am I putting it in the wrong place or writing it out wrong? Thanks "Duane Hookom" wrote: I would use the command button wizard to create a button that opens the report. Then modify the code created by the wizard so that it applies a WHERE CONDITION in the DoCmd.OpenReport method: Dim strWhere as String strWhere = "[ProgNoteID]=" & Me.ProgNoteID DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere This all depends on your report name as well as the primary key field and datatype. -- Duane Hookom Microsoft Access MVP "Steve" wrote: Here is what I have: I have a database for tracking therapy clients. Client data is in one table. Therapy progress notes are in another with a one-to-many relationship. I have a form w/ subform set up to receive the data. I have a query set up to tie the two tables together and feed into a report. (Tables/Forms and Queries all do what I want them to properly) Right now, the report contains data from every client and progress note. What I want is to be able to place a button on the subform for the progress notes, so that when it is clicked it generates the report with just that current entry instead of every single progress note in the database. |
#12
|
|||
|
|||
View/Print Individual Reports
What happens if you remove the strWhere?
Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview -- Duane Hookom Microsoft Access MVP "Steve" wrote: The report is there. I can open it manually from the navigation pane. I can create a button that opens it with every record displayed. When using the code you supplied, I have tried the report title with and without spaces (it has spaces the way it is written on the report itself). For some reason, I get an error saying it doesn't exsist or that the name is misspelled (it is not) and an option to debug. When it opens the debug screen, everything looks like it should. "Duane Hookom" wrote: If the error suggested the report doesn't exist, what do you have to say about that? -- Duane Hookom MS Access MVP "Steve" wrote in message ... The ID field is an autonumber generated by access. I was trying to do this via macro. I realised what you put down there is code, so I went at it that way, and what I get when I press the button is an error message that says the report doesn't exsist. Do you know of a good reference site for setting this up step by step? "Duane Hookom" wrote: Are you actually using code or a macro? You mention "Action arguments" but this doesn't sound like code. Is the ID field numeric or text? -- Duane Hookom Microsoft Access MVP "Steve" wrote: Yes it is. "Duane Hookom" wrote: Is the ID field included in the Report's record source query? -- Duane Hookom Microsoft Access MVP "Steve" wrote: I'm entering that in the "Where condition" of the "Action arguments" section. And keep getting the message that "Access can't parse the expression". My primary key is "ID" the table is "Progress Notes" and the report is "Progress Notes" Below is how I entered the info: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere Am I putting it in the wrong place or writing it out wrong? Thanks "Duane Hookom" wrote: I would use the command button wizard to create a button that opens the report. Then modify the code created by the wizard so that it applies a WHERE CONDITION in the DoCmd.OpenReport method: Dim strWhere as String strWhere = "[ProgNoteID]=" & Me.ProgNoteID DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere This all depends on your report name as well as the primary key field and datatype. -- Duane Hookom Microsoft Access MVP "Steve" wrote: Here is what I have: I have a database for tracking therapy clients. Client data is in one table. Therapy progress notes are in another with a one-to-many relationship. I have a form w/ subform set up to receive the data. I have a query set up to tie the two tables together and feed into a report. (Tables/Forms and Queries all do what I want them to properly) Right now, the report contains data from every client and progress note. What I want is to be able to place a button on the subform for the progress notes, so that when it is clicked it generates the report with just that current entry instead of every single progress note in the database. |
#13
|
|||
|
|||
View/Print Individual Reports
If I put the whole entry:
Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview or just the last line DoCmd.OpenReport "rptProgress Notes", acPrintPreview I get the following when I click the button: "Run-time error '2103' The report name 'rptProgress Notes' you entered in either the property sheet or macro is misspelled or refers to a report that doesn't exsist." I'm not putting it in a macro though, I'm putting it in the code builder. "Duane Hookom" wrote: What happens if you remove the strWhere? Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview -- Duane Hookom Microsoft Access MVP "Steve" wrote: The report is there. I can open it manually from the navigation pane. I can create a button that opens it with every record displayed. When using the code you supplied, I have tried the report title with and without spaces (it has spaces the way it is written on the report itself). For some reason, I get an error saying it doesn't exsist or that the name is misspelled (it is not) and an option to debug. When it opens the debug screen, everything looks like it should. "Duane Hookom" wrote: If the error suggested the report doesn't exist, what do you have to say about that? -- Duane Hookom MS Access MVP "Steve" wrote in message ... The ID field is an autonumber generated by access. I was trying to do this via macro. I realised what you put down there is code, so I went at it that way, and what I get when I press the button is an error message that says the report doesn't exsist. Do you know of a good reference site for setting this up step by step? "Duane Hookom" wrote: Are you actually using code or a macro? You mention "Action arguments" but this doesn't sound like code. Is the ID field numeric or text? -- Duane Hookom Microsoft Access MVP "Steve" wrote: Yes it is. "Duane Hookom" wrote: Is the ID field included in the Report's record source query? -- Duane Hookom Microsoft Access MVP "Steve" wrote: I'm entering that in the "Where condition" of the "Action arguments" section. And keep getting the message that "Access can't parse the expression". My primary key is "ID" the table is "Progress Notes" and the report is "Progress Notes" Below is how I entered the info: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere Am I putting it in the wrong place or writing it out wrong? Thanks "Duane Hookom" wrote: I would use the command button wizard to create a button that opens the report. Then modify the code created by the wizard so that it applies a WHERE CONDITION in the DoCmd.OpenReport method: Dim strWhere as String strWhere = "[ProgNoteID]=" & Me.ProgNoteID DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere This all depends on your report name as well as the primary key field and datatype. -- Duane Hookom Microsoft Access MVP "Steve" wrote: Here is what I have: I have a database for tracking therapy clients. Client data is in one table. Therapy progress notes are in another with a one-to-many relationship. I have a form w/ subform set up to receive the data. I have a query set up to tie the two tables together and feed into a report. (Tables/Forms and Queries all do what I want them to properly) Right now, the report contains data from every client and progress note. What I want is to be able to place a button on the subform for the progress notes, so that when it is clicked it generates the report with just that current entry instead of every single progress note in the database. |
#14
|
|||
|
|||
View/Print Individual Reports
You have spaces in the report name. That can cause problems.
Try using square brackets around the name and see if that takes care of the problem. DoCmd.OpenReport "[rptProgress Notes]", acPrintPreview If that works then you can add in the strWhere to the call to OpenReport as Duane suggested. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Steve wrote: If I put the whole entry: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview or just the last line DoCmd.OpenReport "rptProgress Notes", acPrintPreview I get the following when I click the button: "Run-time error '2103' The report name 'rptProgress Notes' you entered in either the property sheet or macro is misspelled or refers to a report that doesn't exsist." I'm not putting it in a macro though, I'm putting it in the code builder. "Duane Hookom" wrote: What happens if you remove the strWhere? Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview -- Duane Hookom Microsoft Access MVP "Steve" wrote: The report is there. I can open it manually from the navigation pane. I can create a button that opens it with every record displayed. When using the code you supplied, I have tried the report title with and without spaces (it has spaces the way it is written on the report itself). For some reason, I get an error saying it doesn't exsist or that the name is misspelled (it is not) and an option to debug. When it opens the debug screen, everything looks like it should. "Duane Hookom" wrote: If the error suggested the report doesn't exist, what do you have to say about that? -- Duane Hookom MS Access MVP "Steve" wrote in message ... The ID field is an autonumber generated by access. I was trying to do this via macro. I realised what you put down there is code, so I went at it that way, and what I get when I press the button is an error message that says the report doesn't exsist. Do you know of a good reference site for setting this up step by step? "Duane Hookom" wrote: Are you actually using code or a macro? You mention "Action arguments" but this doesn't sound like code. Is the ID field numeric or text? -- Duane Hookom Microsoft Access MVP "Steve" wrote: Yes it is. "Duane Hookom" wrote: Is the ID field included in the Report's record source query? -- Duane Hookom Microsoft Access MVP "Steve" wrote: I'm entering that in the "Where condition" of the "Action arguments" section. And keep getting the message that "Access can't parse the expression". My primary key is "ID" the table is "Progress Notes" and the report is "Progress Notes" Below is how I entered the info: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere Am I putting it in the wrong place or writing it out wrong? Thanks "Duane Hookom" wrote: I would use the command button wizard to create a button that opens the report. Then modify the code created by the wizard so that it applies a WHERE CONDITION in the DoCmd.OpenReport method: Dim strWhere as String strWhere = "[ProgNoteID]=" & Me.ProgNoteID DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere This all depends on your report name as well as the primary key field and datatype. -- Duane Hookom Microsoft Access MVP "Steve" wrote: Here is what I have: I have a database for tracking therapy clients. Client data is in one table. Therapy progress notes are in another with a one-to-many relationship. I have a form w/ subform set up to receive the data. I have a query set up to tie the two tables together and feed into a report. (Tables/Forms and Queries all do what I want them to properly) Right now, the report contains data from every client and progress note. What I want is to be able to place a button on the subform for the progress notes, so that when it is clicked it generates the report with just that current entry instead of every single progress note in the database. |
#15
|
|||
|
|||
View/Print Individual Reports
I think Steve may have entered the code into the property rather than the
module. -- Duane Hookom MS Access MVP "John Spencer" wrote in message ... You have spaces in the report name. That can cause problems. Try using square brackets around the name and see if that takes care of the problem. DoCmd.OpenReport "[rptProgress Notes]", acPrintPreview If that works then you can add in the strWhere to the call to OpenReport as Duane suggested. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Steve wrote: If I put the whole entry: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview or just the last line DoCmd.OpenReport "rptProgress Notes", acPrintPreview I get the following when I click the button: "Run-time error '2103' The report name 'rptProgress Notes' you entered in either the property sheet or macro is misspelled or refers to a report that doesn't exsist." I'm not putting it in a macro though, I'm putting it in the code builder. "Duane Hookom" wrote: What happens if you remove the strWhere? Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview -- Duane Hookom Microsoft Access MVP "Steve" wrote: The report is there. I can open it manually from the navigation pane. I can create a button that opens it with every record displayed. When using the code you supplied, I have tried the report title with and without spaces (it has spaces the way it is written on the report itself). For some reason, I get an error saying it doesn't exsist or that the name is misspelled (it is not) and an option to debug. When it opens the debug screen, everything looks like it should. "Duane Hookom" wrote: If the error suggested the report doesn't exist, what do you have to say about that? -- Duane Hookom MS Access MVP "Steve" wrote in message ... The ID field is an autonumber generated by access. I was trying to do this via macro. I realised what you put down there is code, so I went at it that way, and what I get when I press the button is an error message that says the report doesn't exsist. Do you know of a good reference site for setting this up step by step? "Duane Hookom" wrote: Are you actually using code or a macro? You mention "Action arguments" but this doesn't sound like code. Is the ID field numeric or text? -- Duane Hookom Microsoft Access MVP "Steve" wrote: Yes it is. "Duane Hookom" wrote: Is the ID field included in the Report's record source query? -- Duane Hookom Microsoft Access MVP "Steve" wrote: I'm entering that in the "Where condition" of the "Action arguments" section. And keep getting the message that "Access can't parse the expression". My primary key is "ID" the table is "Progress Notes" and the report is "Progress Notes" Below is how I entered the info: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere Am I putting it in the wrong place or writing it out wrong? Thanks "Duane Hookom" wrote: I would use the command button wizard to create a button that opens the report. Then modify the code created by the wizard so that it applies a WHERE CONDITION in the DoCmd.OpenReport method: Dim strWhere as String strWhere = "[ProgNoteID]=" & Me.ProgNoteID DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere This all depends on your report name as well as the primary key field and datatype. -- Duane Hookom Microsoft Access MVP "Steve" wrote: Here is what I have: I have a database for tracking therapy clients. Client data is in one table. Therapy progress notes are in another with a one-to-many relationship. I have a form w/ subform set up to receive the data. I have a query set up to tie the two tables together and feed into a report. (Tables/Forms and Queries all do what I want them to properly) Right now, the report contains data from every client and progress note. What I want is to be able to place a button on the subform for the progress notes, so that when it is clicked it generates the report with just that current entry instead of every single progress note in the database. |
#16
|
|||
|
|||
View/Print Individual Reports
Thanks for the assistance. For whatever reason, I could not get that method
to work. However, after many hours of looking through these forums, I found the method below that worked for me, and am posting here for anyone esle with the same issue. DoCmd.OpenReport "Progress Notes", acViewPreview, , "[ID] = " & Me.ID Entering that into the button's code pops up just the report with just the record I need. "Duane Hookom" wrote: I think Steve may have entered the code into the property rather than the module. -- Duane Hookom MS Access MVP "John Spencer" wrote in message ... You have spaces in the report name. That can cause problems. Try using square brackets around the name and see if that takes care of the problem. DoCmd.OpenReport "[rptProgress Notes]", acPrintPreview If that works then you can add in the strWhere to the call to OpenReport as Duane suggested. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Steve wrote: If I put the whole entry: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview or just the last line DoCmd.OpenReport "rptProgress Notes", acPrintPreview I get the following when I click the button: "Run-time error '2103' The report name 'rptProgress Notes' you entered in either the property sheet or macro is misspelled or refers to a report that doesn't exsist." I'm not putting it in a macro though, I'm putting it in the code builder. "Duane Hookom" wrote: What happens if you remove the strWhere? Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview -- Duane Hookom Microsoft Access MVP "Steve" wrote: The report is there. I can open it manually from the navigation pane. I can create a button that opens it with every record displayed. When using the code you supplied, I have tried the report title with and without spaces (it has spaces the way it is written on the report itself). For some reason, I get an error saying it doesn't exsist or that the name is misspelled (it is not) and an option to debug. When it opens the debug screen, everything looks like it should. "Duane Hookom" wrote: If the error suggested the report doesn't exist, what do you have to say about that? -- Duane Hookom MS Access MVP "Steve" wrote in message ... The ID field is an autonumber generated by access. I was trying to do this via macro. I realised what you put down there is code, so I went at it that way, and what I get when I press the button is an error message that says the report doesn't exsist. Do you know of a good reference site for setting this up step by step? "Duane Hookom" wrote: Are you actually using code or a macro? You mention "Action arguments" but this doesn't sound like code. Is the ID field numeric or text? -- Duane Hookom Microsoft Access MVP "Steve" wrote: Yes it is. "Duane Hookom" wrote: Is the ID field included in the Report's record source query? -- Duane Hookom Microsoft Access MVP "Steve" wrote: I'm entering that in the "Where condition" of the "Action arguments" section. And keep getting the message that "Access can't parse the expression". My primary key is "ID" the table is "Progress Notes" and the report is "Progress Notes" Below is how I entered the info: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere Am I putting it in the wrong place or writing it out wrong? Thanks "Duane Hookom" wrote: I would use the command button wizard to create a button that opens the report. Then modify the code created by the wizard so that it applies a WHERE CONDITION in the DoCmd.OpenReport method: Dim strWhere as String strWhere = "[ProgNoteID]=" & Me.ProgNoteID DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere This all depends on your report name as well as the primary key field and datatype. -- Duane Hookom Microsoft Access MVP "Steve" wrote: Here is what I have: I have a database for tracking therapy clients. Client data is in one table. Therapy progress notes are in another with a one-to-many relationship. I have a form w/ subform set up to receive the data. I have a query set up to tie the two tables together and feed into a report. (Tables/Forms and Queries all do what I want them to properly) Right now, the report contains data from every client and progress note. What I want is to be able to place a button on the subform for the progress notes, so that when it is clicked it generates the report with just that current entry instead of every single progress note in the database. |
#17
|
|||
|
|||
View/Print Individual Reports
Steve,
You have to understand that until you provide an actual name, we will suggest a name placeholder like "rptProgressNotes". This is a best guess on my part as to what I would name a report of progress notes. If your report doesn't have the same name, you need to understand that you must change it. -- Duane Hookom MS Access MVP "Steve" wrote in message ... Thanks for the assistance. For whatever reason, I could not get that method to work. However, after many hours of looking through these forums, I found the method below that worked for me, and am posting here for anyone esle with the same issue. DoCmd.OpenReport "Progress Notes", acViewPreview, , "[ID] = " & Me.ID Entering that into the button's code pops up just the report with just the record I need. "Duane Hookom" wrote: I think Steve may have entered the code into the property rather than the module. -- Duane Hookom MS Access MVP "John Spencer" wrote in message ... You have spaces in the report name. That can cause problems. Try using square brackets around the name and see if that takes care of the problem. DoCmd.OpenReport "[rptProgress Notes]", acPrintPreview If that works then you can add in the strWhere to the call to OpenReport as Duane suggested. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Steve wrote: If I put the whole entry: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview or just the last line DoCmd.OpenReport "rptProgress Notes", acPrintPreview I get the following when I click the button: "Run-time error '2103' The report name 'rptProgress Notes' you entered in either the property sheet or macro is misspelled or refers to a report that doesn't exsist." I'm not putting it in a macro though, I'm putting it in the code builder. "Duane Hookom" wrote: What happens if you remove the strWhere? Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview -- Duane Hookom Microsoft Access MVP "Steve" wrote: The report is there. I can open it manually from the navigation pane. I can create a button that opens it with every record displayed. When using the code you supplied, I have tried the report title with and without spaces (it has spaces the way it is written on the report itself). For some reason, I get an error saying it doesn't exsist or that the name is misspelled (it is not) and an option to debug. When it opens the debug screen, everything looks like it should. "Duane Hookom" wrote: If the error suggested the report doesn't exist, what do you have to say about that? -- Duane Hookom MS Access MVP "Steve" wrote in message ... The ID field is an autonumber generated by access. I was trying to do this via macro. I realised what you put down there is code, so I went at it that way, and what I get when I press the button is an error message that says the report doesn't exsist. Do you know of a good reference site for setting this up step by step? "Duane Hookom" wrote: Are you actually using code or a macro? You mention "Action arguments" but this doesn't sound like code. Is the ID field numeric or text? -- Duane Hookom Microsoft Access MVP "Steve" wrote: Yes it is. "Duane Hookom" wrote: Is the ID field included in the Report's record source query? -- Duane Hookom Microsoft Access MVP "Steve" wrote: I'm entering that in the "Where condition" of the "Action arguments" section. And keep getting the message that "Access can't parse the expression". My primary key is "ID" the table is "Progress Notes" and the report is "Progress Notes" Below is how I entered the info: Dim strWhere as String strWhere = "[ID]=" & Me.ID DoCmd.OpenReport "rptProgress Notes", acPrintPreview, , strWhere Am I putting it in the wrong place or writing it out wrong? Thanks "Duane Hookom" wrote: I would use the command button wizard to create a button that opens the report. Then modify the code created by the wizard so that it applies a WHERE CONDITION in the DoCmd.OpenReport method: Dim strWhere as String strWhere = "[ProgNoteID]=" & Me.ProgNoteID DoCmd.OpenReport "rptYourProgressNotes", acPrintPreview, , strWhere This all depends on your report name as well as the primary key field and datatype. -- Duane Hookom Microsoft Access MVP "Steve" wrote: Here is what I have: I have a database for tracking therapy clients. Client data is in one table. Therapy progress notes are in another with a one-to-many relationship. I have a form w/ subform set up to receive the data. I have a query set up to tie the two tables together and feed into a report. (Tables/Forms and Queries all do what I want them to properly) Right now, the report contains data from every client and progress note. What I want is to be able to place a button on the subform for the progress notes, so that when it is clicked it generates the report with just that current entry instead of every single progress note in the database. |
|
Thread Tools | |
Display Modes | |
|
|