?
Solved

MS Access datasheet form

Posted on 2013-02-06
4
Medium Priority
?
301 Views
Last Modified: 2013-02-07
I have a form that's opening in datasheet view
I can enter additions fine.

But I need to set the DEFAULT value on the new record on ONE of the  textbox to the value if a function

The function name is getHtID

On the fefault value property in the text box I've tried

=getHtID
getHtID

tried with brackets...
No go.

If I hard code it, it grabs it of course.
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38861056
To make it clearer as to exactly what you have, and what you are doing, please post a sample of this DB


Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Unhide any hidden database objects
10. Compile the code. (From the VBA code window, click: Debug-->Compile)
11. Run the compact/Repair utility.
12. Remove any Passwords and/or security.
13. If a form is involved in the issue, set the Modal and Popup properties to: No
    (Again, unless these properties are associated with the issue)
14. Post the explicit steps to replicate the issue.
15. Test the database before posting.

In other words, ...post a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.

JeffCoachman
0
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 38863100
One option is to use the OnOpen event:

  Me!txtYourTextBox.DefaultValue = getHtID()

As DefaultValue is a string, you may need this:

  Me!txtYourTextBox.DefaultValue = CStr(getHtID())

/gustav
0
 

Author Closing Comment

by:lrbrister
ID: 38863739
Believe it or not...I noticed the Parantheses on your code and tried that...worked.

Seems that at tomes Access requires them and at other times it doesn't
0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 38863754
Yes, outside VBA they are mandatory.

/gustav
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question