Results 1 to 6 of 6

Thread: New to VBA Please help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    168

    Resolved New to VBA Please help

    Hello,

    I'm new to VBA so want some help in MS Access. I've made three tables

    Company
    Order
    Transaction

    Company contains all details of company. Order contains bill no, bill date and total bill amount and Transaction contains Sno,Particulars, rate, qty and amount. I've set the respective relationships i.e. one-to-many between Company and Order and one-to-many between Order and Transaction. I've made a order form with transcation sub form so that I can enter whole bill details and save it to the tables. Now I want a print preview of this using report so I made a report and kept a Preview Report button on the Order Form. But, it shows all records from the table the thing I need is that it should show the records from the current bill.
    Last edited by pbuddy_8; Feb 20th, 2005 at 06:35 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: New to VBA Please help

    When you open your report from the preview button on your form, you need
    to specify any filter conditions or parameters.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    168

    Re: New to VBA Please help

    Please give me an example of that

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: New to VBA Please help

    VB Code:
    1. Private Sub cmdOpenReport_Click()
    2.  
    3.     On Error GoTo Err_Command6_Click
    4.     'Run a menu command to filter the form
    5.     DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, , acMenuVer70
    6.     'Or Open a report with a where condition to limit the records.
    7.     DoCmd.OpenReport "MyReport", acViewPreview, , "ReportID = 888"
    8. Exit_Command6_Click:
    9.     Exit Sub
    10.  
    11. Err_Command6_Click:
    12.     MsgBox Err.Description
    13.     Resume Exit_Command6_Click
    14.    
    15. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    168

    Resolved Re: New to VBA Please help

    Superb Thanks a lot

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: New to VBA Please help

    No prob.

    The where condition in the OpenReport method is like a SQL where clause
    without the word "Where".
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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