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 
Function to Return Value
Juan C Rivera 
            
6 years ago
Good Day Richard, trying something new and I can't figure out how to return a string to Private Sub. I'm in the middle of spending a 4 day weekend with a typhoon at my door. Thinking I love nothing more that to punish my self with Access VBA. LOL. So in a quick snapshot this is what I'm trying to do

Private sub addfile_click()
  Dim StrBE as String
  BackEndParth (StrBE)
  Msgbox StrBe
End Sub

Public Function BackEndParth (StrBE as String) as String
  BackEndParth = Z:\MovieDatabase
End function


What I am trying to get back is Z:\movieDatabase so I can send the string to another function.  So in my code I have man other lines but this is as simple as I can get it and I think I missed a lot. So 1 of two things can you show me quick what I did wrong, and do you have a class on this if I don't have it I will get it in near future.

V/r
Juan

Live Long and Prosper
Richard Rost  @Reply  
          
6 years ago
Hi Juan. I see you've got a lot of my Developer courses but you skipped over the one where I cover creating your own custom functions: Access Developer 2. This is why I always tell people to take them in order. :)

First, you're missing some quotes.

  BackEndParth = "Z:\MovieDatabase"

Next, when you assign that value to the function, you have to GET it and put it into a variable in the calling sub.

  StrBE = BackEndParth()

Now you can:

  MsgBox StrBe

Make sense? I actually haven't created a TechHelp video for this and I know at least 3 or 4 people have submitted questions asking about it. I'll add it to the (quite long) list. If you need to learn quickly though, get Dev 2. It covers all the basics.
Juan C Rivera OP  @Reply  
            
6 years ago
Thank You Richard its amazing with all you have going on and still be able to reply so quickly.  Thank you for the support.

V/r
Juan
Richard Rost  @Reply  
          
6 years ago
My pleasure. I do what I can.
Juan C Rivera OP  @Reply  
            
6 years ago
Richard you hit the ball out of the ball park with the Function tech tip and extended Big thanks

Live long and prosper.
Richard Rost  @Reply  
          
6 years ago
Thanks, Juan.

Peace, and long life.

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: 5/6/2026 8:31:27 AM. PLT: 0s