Results 1 to 6 of 6

Thread: Open report

  1. #1
    Join Date
    Nov 2009
    Posts
    3

    Unanswered: Open report

    I have a form that contains a button to open a report of the current data that was entered. The code that opens the report:

    DoCmd****nCommand acCmdSaveRecord
    DoCmd.OpenReport "rptPatients", acViewPreview, , PatientID = " & Me![PatientID]"


    this code opens the report but when it opens it is blank. Can someone help me get this report to open the current record that was entered?

    Thanks

    Jayde

  2. #2
    Join Date
    Oct 2009
    Posts
    340
    don't understand this at all:
    DoCmd****nCommand acCmdSaveRecord

    is your problem that it is a brand new record? - and thus the table isn't getting the record before the open report command?? if so add a me.dirty=false in the command event before the report open...

  3. #3
    Join Date
    Nov 2009
    Posts
    3
    DoCmd****nCommand acCmdSaveRecord im sorry about the stars but this line saves the record to the table(i think...) im a novice so excuse. Tried the Me.Dirty it doesn't work

  4. #4
    Join Date
    Nov 2009
    Posts
    3
    its DoCmd****nCommand acSaveRecord i don't y the stars keep goin there

  5. #5
    Join Date
    Oct 2009
    Posts
    340
    Dim strWhere as Integer

    strWhere = "[ID] = " & Me.[PatientID]

    DoCmd.OpenReport "rptPatients", acViewPreview, , strWhere

    If your primary key is a Text type field (not a Number type field), you need extra quotes:
    strWhere = "[ID] = """ & Me.[PatientID] & """"

    and of course Dim as a String

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by Jayde View Post
    its DoCmd****nCommand acSaveRecord i don't y the stars keep goin there


    the asterisks appear becuase of a spam filtert installed when we were plagued with spam promotoing roumanian porn sites so the offendeing . r u was edited out

    so it shoud read
    dodmd. r u ncommand
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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