Results 1 to 9 of 9

Thread: how to pass parameters in access report

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Philippines
    Posts
    6

    Unhappy

    i have a query in ms access report that uses a parameters, the problem is, how can i pass a paramater to ms access report using vb code, is this possible?

    thanks
    leagle
    leagle

  2. #2
    Lively Member
    Join Date
    Feb 2000
    Posts
    120

    Post Final Goal

    Hey I already did This but you have to tell me what is your final goal .(report ,select) .

    shachar shaty

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Philippines
    Posts
    6

    Unhappy

    i made a query in msaccess that accept a "date" parameter
    now, i use this query to build a report also in ms access.
    if i run this in ms access it prompts the user to enter the date. i can print the report in vb but how do i pass the required parameters? ... got any idea?


    thanks
    leagle

  4. #4
    Lively Member
    Join Date
    Feb 2000
    Posts
    120

    Thumbs up parameters in access reports

    ok when i did it it was in vb so as for as know you should insert into the view the parameters before the user loads the report such as when he clicks the button you need to insert the parameters and then refresh the view.

    for any help response again i will be glad to help
    shachar shaty

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Philippines
    Posts
    6
    shachar,
    thanks for ur help, i'll try what you have just adviced me.. i'll let you know if it works..



    leagle

  6. #6
    Lively Member
    Join Date
    Feb 2000
    Posts
    120

    Thumbs up Access

    i m waiting for your reply
    shachar shaty

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Philippines
    Posts
    6
    shachar
    this is the code that im using to call the report in ms access, what im trying is to run the report w/out displaying the ms access application..

    Dim myobjAccess As New Access.Application
    myobjAccess.OpenCurrentDatabase ("h:\GL_ACCOUNTS.MDB")
    myobjAccess.DoCmd.OpenReport ("TRANS_YEAR_1_REP")



    leagle

  8. #8
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    Leagle

    try this

    Code:
    Dim myobjAccess As New Access.Application 
    Dim sSQl as string
    Dim dDate as date
    
    'set dDate to equal the value of the date you want to pass to access
    
    'The SQL contains the the date field in the report and
    'the dDate variable
    sSQL = "[Date]=" & dDate 
    
    myobjAccess.OpenCurrentDatabase ("h:\GL_ACCOUNTS.MDB") 
    'myobjAccess.DoCmd.OpenReport ("TRANS_YEAR_1_REP") 
    myobjAccess.DoCmd.OpenReport "TRANS_YEAR_1_REP", _
                                acViewNormal, , sSQL
    You may have to alter the date variable so it is sent as #mm\dd\yyyy#
    Hope this works

    Gazza




  9. #9

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Philippines
    Posts
    6
    thanks for all of ur help, now i can sleep
    leagle

Posting Permissions

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



Click Here to Expand Forum to Full Width