Results 1 to 2 of 2
  1. #1
    Simone is offline Novice
    Windows XP Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    3

    How To Print A Single Record from a Microsoft Access Form into a Report

    Hi, i'm very new to Access and VB, and im about to print a specific record.. but im getting an error with this code (error is "Type mismatch").


    My reports name is Tilsynsskjema utskrift.
    Primary key is ID.
    The forms name is frmTobakkTilsyn.


    Option Compare Database


    Private Sub Kommando320_Click()
    DoCmd.OpenReport [Report_Tilsynsskjema utskrift], acViewPreview, , "ID = " & Forms!Form_frmTobakkTilsyn

    End Sub

  2. #2
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    1,715
    You need to refer to the ID field on the form, assuming the command button is on the form then
    Code:
    Private Sub Kommando320_Click()
    
         DoCmd.OpenReport [Report_Tilsynsskjema utskrift], acViewPreview, , "ID = " & Me.ID
    
    End Sub
    Should work. When you type the Me. you should get intellisense to show you available form controls you can reference.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Print Report for Single Record
    By Ryanm0085 in forum Reports
    Replies: 13
    Last Post: 05-03-2017, 08:33 AM
  2. Print single record in report and view
    By banpreet in forum Reports
    Replies: 3
    Last Post: 01-12-2017, 02:38 PM
  3. Print out single record onto a report
    By CQCDave in forum Access
    Replies: 2
    Last Post: 04-23-2015, 06:54 AM
  4. Print out single record onto a report
    By CQCDave in forum Access
    Replies: 14
    Last Post: 01-08-2015, 12:55 PM
  5. How to print a single Record's report?
    By yes sir in forum Access
    Replies: 7
    Last Post: 09-20-2010, 07:31 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 - Senior Forums