Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85

    Cool Unanswered: Printing current record on form as report format

    Dear All

    On my form I want to add a button that when clicked would print the current record on form in a report format not in form view format. So that I can choose which fields to print for that record.

    How can I do it?

    Thanks

  2. #2
    Join Date
    Jan 2003
    Location
    Aberdeen, Scotland, UK
    Posts
    168

    Frm a command button...

    DoCmd.OpenReport "john", acViewNormal, , "[PrimaryKey} = " & Me.PrimaryKey

    Where PrimaryKey is your ID.
    J.

  3. #3
    Join Date
    Mar 2003
    Location
    UK
    Posts
    85

    Smile Thank you very much

    Johncameron

    Thank you veyr much for your help. I have tried it and it worked just like the way I wanted. T

    Thank you very much for your help.

  4. #4
    Join Date
    Oct 2003
    Posts
    12
    Hi,

    In relation to the same problem, I have entered the code as above in to a "print" button of my form but when I clicked on the button, why am I still being prompted to enter the Primary Key? Why can't it pick up the Primary Key of the record I am viewing?

    Your comments appreciated.

  5. #5
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    There is a slight typo error in the code, try this;

    Old
    "[PrimaryKey} = " & Me.PrimaryKey

    New
    "[PrimaryKey] = " & Me.PrimaryKey

  6. #6
    Join Date
    Oct 2003
    Posts
    12
    Hi Bill, thanks for the reminder. I corrected the typo error. I noticed that the report now does print the record that's being displayed. However, I still get a prompt to enter a primary key value. The funny thing is it does not matter what value that I enter but the record displayed will be printed. I could not identify what is prompting the input.

  7. #7
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    Does your command line look like this

    DoCmd.OpenReport "YourReportName", acViewNormal, , "[YourPrimaryID] = " & Me.YourPrimaryID


    Is your report based on a query. If yes, check your criteria for a parameter for something like this [ ]in the ID column. Remove this if its is there. This can cause the paremeter box to appear.

    let me know how u go.
    Last edited by billjov; 10-12-03 at 22:21.

  8. #8
    Join Date
    Oct 2003
    Posts
    12
    Hi Bill, I don't have any queries behind the report. The following is the code I have :-

    DoCmd.OpenReport "DO", acPreview, , "[DOID]=" & Me.DO_ID

    It beats me why do I have a different DOID and DO_ID. I am only using DOID for all my Primary Key field. The wierd thing is even when the prompt comes up, all I need to do is click on OK and the preview will come on correctly, even though I did not enter any value at all.

  9. #9
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    any chance of posting the DB. Im sure if u post it that someone will be able to solve your problem.

  10. #10
    Join Date
    Oct 2003
    Posts
    12
    Hi Bill, thanks for the suggestion. I have attached the DB with this post. It should be an easy fix but I guess I am still too new with Access. I would appreciate all help.
    Attached Files Attached Files

  11. #11
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    Im still learning too! but these forum should speed up knowledge. Dont feel shy to ask the most basic question. We are all here to help each other. I'd be lost with the support of DB fourms.

    I dont suppose you can convert it 97 version.

    Try to get the DB to a smaller size if u can by compacting.

  12. #12
    Join Date
    Oct 2003
    Posts
    12
    Thanks for the kind words. I have converted the DB to a "prior" version. I didn't get to select Access97 anywhere. I also did the compacting but to my amazement the DB actually got bigger after that. I managed to zipped it up though...but it's still a meg of file.
    Attached Files Attached Files

  13. #13
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    here ya go. see if this is Ok

  14. #14
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    here ya go. see if this is Ok
    Attached Files Attached Files

  15. #15
    Join Date
    Oct 2003
    Posts
    12
    Thanks Bill. It works the way I want it to but it will take me a while to absorb the changes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •