Results 1 to 2 of 2
  1. #1
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012

    Exclamation How To Pass a String to a Parameter in a Report

    I am trying to pass a variable to a parameter. I have a form that has a button in it. When I click that button, I have it opening a report. When that report opens, it prompts for a name. I want to automatically send a name to that parameter so that the user wont have to input the name. When the report opens, it asks for Forms!frmSearch!cmbCoach, which is just a combo box that I made that has a list of people in it and when you input a name, it searches my database and displays information concerning that person. Basically, I have a login screen that asks for ID and Name. txtIDNum points to the Name box. I want to pass that Name to the report parameter so the user doesnt enter the name. I've looked at examples and I'm not really understanding the Me.variable syntax. Any help would be much appreciated. Thank you in advance.

    Private Sub Command16_Click()
     txtIDNum = Forms![LoginForm2]![Text13]
        If Len(txtIDNum > 0) Then
            DoCmd.OpenReport "rptDiscussionLogbyCoach", acViewReport, , , , txtIDNum
            MsgBox "Please enter your name"
            Exit Sub
        End If
    End Sub

  2. #2
    hammer187 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2012
    I solved it. I just recreated my query that my report was based on and changed my parameter to use my other control instead of my combo box.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-14-2012, 05:08 PM
  2. Replies: 2
    Last Post: 02-10-2011, 10:44 AM
  3. Pass image parameter to stored procedure
    By Kencao in forum Programming
    Replies: 3
    Last Post: 04-28-2010, 11:51 PM
  4. Pass list as parameter to in operator
    By bliever in forum Queries
    Replies: 5
    Last Post: 11-11-2009, 03:15 AM
  5. Pass a Parameter From a form to a Query
    By DDillesha in forum Forms
    Replies: 1
    Last Post: 10-28-2009, 12:49 PM

Tags for this Thread

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