|
-
Jan 15th, 2007, 11:25 AM
#1
Thread Starter
Junior Member
Pass values from a Access form to a report
Hi All,
I have a simple form in MS Access. It contains a customer ID, name and a command button.
What I want the command button to do is pass the customer ID to a report and print the customers details according to the customer ID.
So the user selects a customer ID clicks the command button and the details of the customer according to ID prints.
Any Thoughts?
mccreaso
-
Jan 15th, 2007, 03:02 PM
#2
Re: Pass values from a Access form to a report
What I want the command button to do is pass the customer ID to a report and print the customers details according to the customer ID.
1) Simply set the value of the report control in the OnOpen property of the report:
VB Code:
Report[reportname]: OnOpen
'lets say the textbox will store the Cust ID
Me![TextBox] = Forms!frm[Formname]![custId]
You must open the report before closing the form, otherwise the reference will not be valid.
2) Use Dlookup() for getting the details from the table based on cust ID.
I haven't tried it yet...
Hope it helps...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jan 15th, 2007, 03:10 PM
#3
Re: Pass values from a Access form to a report
Better would be to create a new class and create a read/write property where you can set the value from the form and read it from the report. his will allow the form to be closed or be open still without affecting anything else.
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|