[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

MS Access datasheet form

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
lrbrister
Asked:
lrbrister
  • 2
1 Solution
 
Jeffrey CoachmanCommented:
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
 
Gustav BrockCIOCommented:
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
 
lrbristerAuthor Commented:
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
 
Gustav BrockCIOCommented:
Yes, outside VBA they are mandatory.

/gustav
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now