Greetings,
I need to brush up on my somewhat rusty Access skills. The problem I face is a very elementary one but for the life of me I cannot figure out how to solve it.
A form in my database needs to record the time a user adds a record and update this in the relevant table. I have created a textbox in the form which is bound to the associated field in the table. This textbox is hidden the locked, so the user will not be able to see or use it.
I am trying to display the time in this textbox when a command button is clicked. Since this textbox is bound to the relevant field in the table, that updates when the textbox's value changes. My textbox is "EntryTime" , my command button "Save". Here's the code I currently have: -
Private Sub Save_Click()
-
EntryTime.Text = Time
-
End Sub
-
This gives me the error "Runtime error 2185: You can't reference a property or method for a control unless the control has the focus". I have tried different variations on my code, but cannot get past this error.
I would greatly appreciate it if someone can shed some light on this.
Thanks.
4 1997 MMcCarthy 14,534
Recognized Expert Moderator MVP
Greetings,
I need to brush up on my somewhat rusty Access skills. The problem I face is a very elementary one but for the life of me I cannot figure out how to solve it.
A form in my database needs to record the time a user adds a record and update this in the relevant table. I have created a textbox in the form which is bound to the associated field in the table. This textbox is hidden the locked, so the user will not be able to see or use it.
I am trying to display the time in this textbox when a command button is clicked. Since this textbox is bound to the relevant field in the table, that updates when the textbox's value changes. My textbox is "EntryTime" , my command button "Save". Here's the code I currently have: -
Private Sub Save_Click()
-
EntryTime.Text = Time
-
End Sub
-
This gives me the error "Runtime error 2185: You can't reference a property or method for a control unless the control has the focus". I have tried different variations on my code, but cannot get past this error.
I would greatly appreciate it if someone can shed some light on this.
Thanks.
You can't update a locked control.
Hide it and set enabled to false if you wish but don't lock it.
Mary
You can't update a locked control.
Hide it and set enabled to false if you wish but don't lock it.
Mary
Thanks for the quick response. I tried unlocking the textbox but still get "Runtime error 2185: You can't reference a property or method for a control unless the control has the focus".
Thanks
Thanks for the quick response. I tried unlocking the textbox but still get "Runtime error 2185: You can't reference a property or method for a control unless the control has the focus".
Thanks
Sorry, I forgot to add that I can change the value in textbox "EntryTime" with any of its own methods (LostFocus, etc.). Just can't seem to do it with any other control.
MMcCarthy 14,534
Recognized Expert Moderator MVP
Try this ... -
Private Sub Save_Click()
-
-
Me!EntryTime.SetFocus
-
Me!EntryTime.Value = Time
-
-
End Sub
Mary
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Manfred Schwab |
last post by:
Recording messages and print statements in a textfile during program
execution.
Is there a similar command to redirect errormessages or print statements
into a standart asciifile during programm execution.
I would like to echo the complete console output into a textfile and
send this file as email at a certain point in time.
The programm execution shall not be stopped.
|
by: Steve Miller |
last post by:
hello...
i am a 'user' of access, meaning, i import excel files, join, and
merge....that's about the extent of my expertise with ms-access. my
boss wants me to create an access application that will replace our
'excel' version of time reporting. we use ms-access 2000. i have a
huge book (mastering access 2000) though the cd is missing. i looked
at using the wizard for time reporting, but is was designed for
external clients, and the...
|
by: Chris Thompson |
last post by:
I have an Access 97 database to record the current location and status
of files in our office.
Each file has a record one field of which is it's current location.
On the form for each record is a 'limit to list' combobox from which
the user can update the file's current location.
I would like to be able to record the history of where a file has
been, so to do this I set up a second table linked to the first one by
a one to many...
|
by: Paul |
last post by:
I have a form that is bound on a table. The form has a text box that
has
=Time() and an Add button. How can I update the time or make it the
current time before adding a record on the table via the form? I tried
putting Time() on the Add event's code before the "DoCmd.GoToRecord ,
, acNewRec" line but, it still doesn't pick up the current time. It
only updated the text box after the record has been added.
I tried using the Form's "On...
|
by: luscus |
last post by:
I am trying to device a formula so that when i check of a yes/no box
(done) it will automatically add the time in a field called "End
Time" and at the same time stamp the amount of minutes between a field
"begining Time" ( which already automatically stamps the time as you
enter a new record) and the field "end time"
For example : If I begun the new record at 2:45 PM worked on the
problem untill 3:00 PM and solved it. I would then...
| |
by: Sakharam Phapale |
last post by:
Hi All,
I am developing an application like sound recorder.
While recording if there is a silence for more than given time (say 5
seconds),
Recording should be paused.
|
by: zhangzhi |
last post by:
HI£º
i have a big problem about audio recording. my boss wanna a application
of audio monitor, and he wanna it will detect voice and start recording
automatically, avoiding recording silences.
thanks for giving me a little clue, and Great U for sending me a copy of
code of C#. or I will be Fired in a week.
|
by: Seymour |
last post by:
I am trying to find a way to sign onto my Wall Street Journal account
(http://online.wsj.com/public/us) and automatically download various
financial pages on stocks and mutual funds that I am interested in
tracking. I have a subscription to this site and am trying to figure
out how to use python, which I have been trying to learn for the past
year, to automatically login and capture a few different pages.
I have mastered capturing web...
|
by: PWS |
last post by:
Hi all,
I developed an online learning website where each student has his own
username/password and they can view course materials and take tests
online. I did that in PHP and PostgreSQL.
Now, I need to implement a function that I don't seem to be doing
right. A course has multiple modules under it and a module has several
pages, all are done in PHP. I am required to log the times (durations)
each student spends on a module. Duration...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |