Results 1 to 5 of 5
  1. #1
    cvolkers is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Sep 2010
    Location
    South Dakota
    Posts
    9

    Printing a single Report from two forms

    I have an access program tha I have been using for years. I love it, have slowly been searching and making updates here and there. Anywho, I have a main form that has the customers information and then I have a window on a lower part of the main for that is a subform. So I have Customer ID, and Problem ID. Those are the two IDs for the data. I also have a report that this all prints too called "Work Order Preview Report"
    when I click on the buttom it asks me for the customer id and then the problem ID like before. I have to manually put them in. I would love it to be automatic. I have the following code in another database that I use. It's a single form, but works great.



    Private Sub Command313_Click()
    Dim strWhere As String
    If Me.Dirty Then 'Save any edits.
    Me.Dirty = False
    End If
    If Me.NewRecord Then 'Check there is a record to print
    MsgBox "Select a record to print"
    Else
    strWhere = "[Customer ID] = " & Me.[Problem ID]
    DoCmd.OpenReport "Work Order Preview Report", acViewPreview, , strWhere
    End If
    End Sub

    I have just copy and pasted things from here to there. I understand a little of the programing language but not much. Any help would be great.

    Thanks.
    Chad

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    strWhere = "[Customer ID] = " & Me.[Problem ID]


    are you saying that the [Problem ID] field is now in a subform?

    the Me. syntax appears to be that for a field in the main form.

    try:

    & Me.SubformName.Form![Problem ID]

    the SubformName should fill in automatically via intellisense...and Form! is literal....

  3. #3
    Access_Blaster is offline User
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    339
    Can you show a relationships screen shot. You may not be linked properly.

  4. #4
    cvolkers is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Sep 2010
    Location
    South Dakota
    Posts
    9
    Sorry, I have not been able to get back to this issue... Thank you for your help... Still trying to get this to work.

    Yes the subform is the Problem ID

    I added that line in and it will Still doesn't work.

  5. #5
    cvolkers is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Sep 2010
    Location
    South Dakota
    Posts
    9
    Let me know if this helps...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to print a single Record's report?
    By yes sir in forum Access
    Replies: 7
    Last Post: 09-20-2010, 07:31 AM
  2. Printing a single report from form
    By OFA in forum Forms
    Replies: 9
    Last Post: 06-08-2010, 09:27 AM
  3. Replies: 5
    Last Post: 05-24-2010, 11:52 AM
  4. Print Single Report
    By emkwan in forum Access
    Replies: 1
    Last Post: 01-29-2010, 11:19 AM
  5. Replies: 2
    Last Post: 02-10-2009, 12:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums