Solved

MS Access datasheet form

Posted on 2013-02-06
4
298 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 50

Accepted Solution

by:
Gustav Brock earned 500 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 50

Expert Comment

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

/gustav
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

705 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