Solved

MS Access datasheet form

Posted on 2013-02-06
4
290 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
  • 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 49

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 49

Expert Comment

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

/gustav
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Trying to lock certain controls by calling function 7 42
VBA Shell can't Find Word document 11 45
Resize text 4 16
Max per month 3 15
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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 …

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now