VBA openreport filter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lokerin
    New Member
    • Mar 2008
    • 3

    VBA openreport filter

    ok here is my problum i have been trying to kick this line of code around for 3 days. i know the problum is staring me in the face i am working on xp office 2007


    DoCmd.OpenRepor t "Report A", acViewPreview, , "Medical Record # ='" & Me.Medicalrec & "'"


    this makes a syntax error "(missing operator) in qurry expression" that i cant seem to cant seem to figure out
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Originally posted by Lokerin
    ...DoCmd.OpenRe port "Report A", acViewPreview, , "Medical Record # ='" & Me.Medicalrec & "'"...
    Hi. If a fieldname has spaces in it you need to enclose the fieldname in square brackets, as shown below. It's an easy thing to overlook...
    [code=vb]DoCmd.OpenRepor t "Report A", acViewPreview, , "[Medical Record #] ='" & Me.Medicalrec & "'"[/code]
    -Stewart

    Comment

    • Lokerin
      New Member
      • Mar 2008
      • 3

      #3
      Originally posted by Stewart Ross Inverness
      Hi. If a fieldname has spaces in it you need to enclose the fieldname in square brackets, as shown below. It's an easy thing to overlook...
      [code=vb]DoCmd.OpenRepor t "Report A", acViewPreview, , "[Medical Record #] ='" & Me.Medicalrec & "'"[/code]
      -Stewart
      Thank you I after cursing at the computer i am now going to lunch and sulk over a cup of ramon

      Comment

      Working...