Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
SQL and Getting Data From Another Form
Colin Eastaugh 
     
3 months ago
Two forms.

In FormA

I have a button that sends data from a label called "Tick" and puts it into label "TickZ" in FormB

DoCmd.OpenForm "FormB", , , acFormEdit
Forms!FormB!TickZ = Tick

In FormB I use the On Load command to run an SQL procedure that selects records from a table.  The WHERE statement doesn't seem to recognise the information contained in label "TickZ". (I have also used On Current and On Open, but with the same result.)

I have had to include a button on FormB to action the WHERE part of the SQL procedure.  

It would appear that when FormB is loaded, the transfer of data from FormA into FormB is ignored. (When I am in FormB I can see the information transferred sitting in TickZ.)

Is there a way of avoiding the extra keystroke?  Thanks.
Donald Blackwell  @Reply  
       
3 months ago
First, the command you typed is missing a comma, acFormEdit is in the where condition spot, so if that's not just a type where you copied it to the forums, that could be what is preventing your other code from running. [FormName], [View],[Filter],[Where],[WindowMode],[OpenArgs]

Otherwise:

You could include "Tick" in OpenArgs for your form open and then check that in the form load event.

For example:

DoCmd.OpenForm "FormB", , , , acFormEdit, , Tick

Then in the form_load:

If Not IsNull(OpenArgs) Then
   DoAction OpenArgs
end if


Replace DoAction OpenArgs with whatever you're trying to do

Richard discusses OpenArgs in Custom MsgBox 2
Colin Eastaugh OP  @Reply  
     
3 months ago
Donald

I'm feeling a tad emotional.  

You are a star.  Today is not wasted because of your speedy response.  OpenArgs have entered my life.  I'm sure that I'm going to have to get to grips with TempVars one day, and I really need to set some time to one side to understand Recordsets and Recordclone, I really should have them in my Access toolkit, but on this Sunday I'm very happy that you have brought OpenArgs into my life, and I no longer have to press two buttons going forward.

It may be half a second you have saved me but the aesthetic pleasure is immense because the database will really fly going forward.

Thanks again.

Colin
Donald Blackwell  @Reply  
       
3 months ago
Glad to be of assistance.

Where OpenArgs really shines is if you open a form as a Dialog because as soon as it opens, all code in the form that opened it stops until the Dialog form closes so it helps you to get info passed easily.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/20/2026 12:34:39 AM. PLT: 0s