Results 1 to 3 of 3
  1. #1
    euphonium01 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    40

    Open Report from Subform Control using Macro

    Hi.

    I have a Subform within a main Form, the Subform is called BBIS. Within the Subform is a Control named Serial #, I have set this Control to OnClick trigger a Macro to open a Report called BBIS PrintOut. As there are a list of Serial # listed in the Subform, I would like the Report to open with the specific Serial # I click on in the Subform.

    I've tried nearly all I can think of, including ="[Serial #]=" & [Screen].[ActiveControl] in the Where Condition, all I get is 'Data type mismatch in criteria expression' yet the Subform and Report get their data from the same table, so how can there be a 'Data mismatch'? or am I missing something obvious? I am a novice user?



    I am using Win 7 64bit, Office 2013

    PS. I know vba would be better but I need to learn Access 1st!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Your example has the serial as a number. I doubt that...it is probably a text value.
    put quotes around it.
    [seria#]= ' " & form.control & " ' "

  3. #3
    euphonium01 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    40
    You're exactly right Ranman, I'm sorry if I misled you, it is a 'Short Text' field as sometimes the Serial # can include letters as well as numbers, however each record is unique. I copied and pasted the example you gave me but I get an error saying invalid Where Condition?

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

Similar Threads

  1. Replies: 6
    Last Post: 02-23-2014, 05:53 PM
  2. Replies: 2
    Last Post: 10-09-2013, 05:45 PM
  3. Replies: 3
    Last Post: 02-15-2013, 03:36 PM
  4. Macro - Open Report, SetValue
    By NLA in forum Programming
    Replies: 1
    Last Post: 11-17-2012, 09:53 PM
  5. Macro to open a report that includes certain dates?
    By hartandsoul85 in forum Access
    Replies: 2
    Last Post: 05-11-2012, 11:47 AM

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