473,324 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Value of text box before it is saved

11
I have an unbound text box on an MS ACCESS 2000 form that has an imput mask set for short dates, i.e. 04/11/09. I have some code within the ON_CLICK event of this control that puts the curser at the front, left hand side, of the text box.

I only want this code to work if there is no value within the text box. It works fine when the textbox is empty and ignors the code as expected if I click on something else after adding a date and then click back into the textbox.

My problem is the textbox has no value if the user is currently typing something in for the first time. If the user is currently typing a date and wants to click on another part of the date to correct it the cursor is positioned at the front regardless of where the user clicked. Following is the code i'm using in the ON_CLICK event, any help would be appreciated.

Expand|Select|Wrap|Line Numbers
  1. If IIf(IsNull(Me.ActiveControl), "", Trim(Me.ActiveControl)) = "" Then
  2.     Me.ActiveControl.SelStart = 0
  3. End If
Nov 4 '09 #1

✓ answered by ChipR

You can use the textbox.Text property to get the currently contents.

3 2478
ChipR
1,287 Expert 1GB
You can use the textbox.Text property to get the currently contents.
Nov 4 '09 #2
SonOf27
11
Many thanks for that ChipR. I guess one should not rely so heavily on autocomplete as Text is not one of the drop down options of ActiveControl but it does work. Thanks again, it works well.
Nov 4 '09 #3
ChipR
1,287 Expert 1GB
The reason it doesn't show up is probably because the property doesn't exist for every possible control that may be the ActiveControl. Be careful using it, you may want to test the type of the control first.
Nov 4 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: koen colen | last post by:
Hello group, I hope you guys can help me out, I am modifying a piece of code from Joe Norman, I did found the code here: http://www.intranet2internet.com/public/default.asp?PAGE=sscript&ID=3 ...
4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
10
by: Kenneth Brody | last post by:
I recently ran into an "issue" related to text files and ftell/fseek, and I'd like to know if it's a bug, or simply an annoying, but still conforming, implementation. The platform is Windows,...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
17
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get the value of a form control? -----------------------------------------------------------------------...
6
by: Ben | last post by:
I posted on this forum several days ago and got helpful replies. but, most replies directed to html file download. I rephrase my question here. I am working on a project collecting data from...
0
by: Jon Paal | last post by:
--dropdownlist value isn't being saved to database from FORMVIEW --field PriorityID is datatype "number" (integer) what's missing ???? '=========code============= <asp:Content ID="Content1"...
1
by: empiresolutions | last post by:
Hello fellow code junkies, I am using the "Ajax dynamic list" http://dhtmlgoodies.com/index.html?whichScript=ajax-dynamic-list and i think its the best out there. I have found a compatibility...
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
3
Markus
by: Markus | last post by:
Ok, so I'm just messing around with c# at the moment, learning some stuff -- it is surprisingly similar to JavaScript :S -- and I hit a snag: I'm grabbing the value of a texbox and then setting the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.