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 Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Passvalue
Dg Ewing 
     
10 months ago
I have a form (MDKA_Form) with a subform. The subform shows the parents of the main forms record.  I am trying to click on the "father_ID" and pass that value to the main form to open his record which will show his his father....keep clicking and go back another generation...it works if I manually enter the "INDI_ID" into the "Enter Parameter Value dialog box.

Father_ID = INDI_ID and Mother_ID = INDI_ID

The subform gets its data from table "FatherMotherT"
The mainform source is IndexMasterExtQ

The main and sub are linked using INDI_ID

Dg Ewing OP  @Reply  
     
10 months ago

Richard Rost  @Reply  
          
10 months ago
The problem is likely your underscore. That's why I tell you to only use letters and numbers in your field names and your table names and such. Try putting brackets around it. And don't forget if that criteria is a string value, you need quotes as well.

"[LAST_NAME]=""" & LastNameField & """"
Kevin Robertson  @Reply  
          
10 months ago
Is everything spelled correctly?
Since you are using an underscore in your names it is advisable to enclose them in square brackets.

Enter Parameter Value
Kevin Robertson  @Reply  
          
10 months ago
Beat me to the punch Richard :)
Dg Ewing OP  @Reply  
     
10 months ago
It worked for a long time and then I migrated to a new DB cleaned up tables and Q renamed fields and eliminated redundant data, and now that the DB is clean and fresh it doesnt work....I hope you can help as I have spent hours trying to figure out what minor infraction I have created
Dg Ewing OP  @Reply  
     
10 months ago
Thanks let me get rid of the brand new underscores....and see that fixes it..
Kevin Robertson  @Reply  
          
10 months ago
What Data Type is your ID field?

The reason I ask is you have declared passvalue as a String variable.
The ID is numeric so passvalue should be declared as a Long.
Dg Ewing OP  @Reply  
     
10 months ago
the value of the id is i121 ....the IDs begin with i (eye)
Dg Ewing OP  @Reply  
     
10 months ago
I have taken all of the underscores out...and still not working...
Dg Ewing OP  @Reply  
     
10 months ago
Kevin what is the easiest way to delete the first character "i" so that I can make my IDs numbers?
Kevin Robertson  @Reply  
          
10 months ago
Thomas Gonder  @Reply  
      
10 months ago
Dg I have tons of underscores in table and control names (since Ver. 2018, now 365). Not yet any problem whenever I need them. No brackets needed. Probably some other problem, since it remained after removing "_".

I'm thinking if your Father_ID is a string, you'll have to surround it with quotes.
Dg Ewing OP  @Reply  
     
10 months ago
Thomas   Where would I put the quotes?

Private Sub FatherID_Click()
   Dim passvalue As String
   Dim strsearch As String
    
     passvalue = Me!FatherID
    
    DoCmd.Minimize
    
    MsgBox passvalue
    
  DoCmd.OpenForm "MDKA_Form", , , "INDIID=" & passvalue
  
End Sub
Kevin Robertson  @Reply  
          
10 months ago
Dg Ewing OP  @Reply  
     
10 months ago
my gut is telling me that it has something to do with getting the passvalue from a subform and trying to filter on the mainform...
Dg Ewing OP  @Reply  
     
10 months ago
Kevin  could you rewrite the code so I can see what you mean,  I have always struggled with double double even after watching Richard's video over 100+ times....
Richard Rost  @Reply  
          
10 months ago
You have to include your pass value inside of double-double quotes. And I would still put the field name with the underscore inside of brackets. You don't need it everywhere, but sometimes you do.

DoCmd.OpenForm "[MDKA_Form]", , , "INDIID=""" & passvalue & """"

Thomas Gonder  @Reply  
      
10 months ago
Being klutzy with typing, since I couldn't just copy & paste your code, it's best to let Richard, the speed typist, do it.
Which I see he did.

Did that solve the problem? I'm guessing that Access didn't like what you passed in, so it just popped up the box asking, "So, what do you want here" (Enter Parameter Value), instead of some appropriate error message.

Which highlights a better way to program when you call subroutines. Instead of letting the subroutine just try to handle an error, it's a good programming practice to pass back an error code to the calling routine and let the higher-level routine give a better error message or deal with it appropriately. In this case, it looks like the SQL routines for the passed parameter dealt with the error instead of DoCmd.OpenForm throwing a runtime error (which would have eliminated all your huh?).
Dg Ewing OP  @Reply  
     
10 months ago
Richard Yea, after determining I had too many "INDIID="""" & ....

It Works!!!!!!!!!!!!!!!!!!!!!!

I hate the double and double quotes.....I just don't get the logic (yet)
Richard Rost  @Reply  
          
10 months ago
Watch this video too. It might turn the lightbulb on:

DDQ Not SQ
Dg Ewing OP  @Reply  
     
10 months ago
Richard The light bulb (with rheostat) started to brighten when you gave the origin of double double being a function of concatenation.....

and then when I looked at the what property value needed in the filter property, the rheostat went to full blast....I have the logic solidly nailed.....it will take some practice to get the syntax to be natural

Thanks, you are and have been the number 1 instructor of my 70+ years....and I have had some really awsome instructors!!
Dg Ewing OP  @Reply  
     
10 months ago

Richard Rost  @Reply  
          
10 months ago
Dg awesome. Glad you figured it out - and thanks for the compliment. :)

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 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/16/2026 7:35:26 PM. PLT: 0s