Free Lessons
Fast Tips
Topic Index
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
Home > Courses > Access > Developer > D33 > < D32 | D34 >
Back to Access Developer 33    Comments List
Const in Default Value Upload Images   Link   Email  
Eduardo Benaim       
13 months ago
If I have A Global Const MyServer = ""  

How do I put it in the "Default value" for a Field in a Form?

Apparently you can not put a Global Constant or Variable there.

Remember you making comments about it and had a solution. cant remember
Kevin Robertson             
13 months ago
Add an unbound text box to your form (as an example, I'm naming it txtServer) then add this to the On Load event of the form.

txtServer = MyServer

Since Constants cannot be changed I would also lock the text box.
Eduardo Benaim       
13 months ago
Yes but txtServer =  MyServer  & "\Docs\Document"   Does not work
Kevin Robertson             
13 months ago
What doesn't work?
Are you getting an error?

'Does not work' doesn't tell us anything.
Richard Rost             
13 months ago
Is this in a public module or a form module?
Richard Rost             
13 months ago
Nevermind... I just re-read your question. What you're trying to do won't work. You can't use a VBA variable or constant in the default value property of a field. You can do it in code, but not directly. I'd recommend using a TempVars value. This would actually make a good tip video. Give me an hour.
Richard Rost             
13 months ago
Here you go: Variable Default
Eduardo Benaim       
13 months ago
This video is Great. I love the TempVars solution. Thank you very much.
Scott Axton            
13 months ago
Richard maybe a TempVars video has come to it's time?
Advocating on behalf of Adam (as well as myself and others)
Kevin Robertson             
13 months ago
Yeah, I'm using TempVars a lot in my current database for user logons. Before it was always a Public variable in a module which is how I started this database until any errors generated cleared the variables and I had to go through the login process each time. Not a problem now I've switched to TempVars.
Eduardo Benaim       
13 months ago
Yes.  I second (or third) the motion for the video about TempVars.  Great Work!!!
Adam Schwanz              
13 months ago
Did somebody say TempVars?
Eduardo Benaim       
13 months ago
I can't hear you... Please say it Louder...
Richard Rost             
13 months ago
I'm throwing a little TempVars action in the Calculator video coming up...

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


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

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

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/25/2024 9:34:03 AM. PLT: 1s