473,397 Members | 1,969 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,397 software developers and data experts.

Self updating character counter?

56
Yet another question I'm afraid!

I have subform which contains a textbox. On the main form, I have a textbox which is counting the amount of characters left the user has left to create a comment with by using:

=255-Len([AccountCardComments])

the only thing is, it doesn't update after typing, only after refocussing somewhere else, and it only seems to provide the length for the first comment. If I start to move between records, or even comment number on the subform, the length stays fixed on the first entry of the AccountCardComments table.

Tried using requery but that causes my form to go blank. So open to any suggestions. Its more of a 'nice to have' feature so don't worry if you can't help. I can always replace it with a piece of validation when the record tries to update instead, but I thought this would be a nice visual feature.

Thanks once again,

Si (the person who is learning on the fly!)
Apr 19 '07 #1
3 1799
ADezii
8,834 Expert 8TB
Yet another question I'm afraid!

I have subform which contains a textbox. On the main form, I have a textbox which is counting the amount of characters left the user has left to create a comment with by using:

=255-Len([AccountCardComments])

the only thing is, it doesn't update after typing, only after refocussing somewhere else, and it only seems to provide the length for the first comment. If I start to move between records, or even comment number on the subform, the length stays fixed on the first entry of the AccountCardComments table.

Tried using requery but that causes my form to go blank. So open to any suggestions. Its more of a 'nice to have' feature so don't worry if you can't help. I can always replace it with a piece of validation when the record tries to update instead, but I thought this would be a nice visual feature.

Thanks once again,

Si (the person who is learning on the fly!)
You need to 'Hook' the code in the KeyPress() Event of your Field on the Sub-Form. Assuming the Field on the Main Form to keep the runnig count is called txtCounter:
Private Sub AccountCardComments_KeyPress(KeyAscii As Integer)
Static intCharCounter As Integer
intCharCounter = (intCharCounter + 1)

Me.Parent![txtCounter] = (255 - intCharCounter)
End Sub
Apr 19 '07 #2
Widge
56
Wonderful, Parent is what I was missing!
Apr 19 '07 #3
ADezii
8,834 Expert 8TB
Wonderful, Parent is what I was missing!
Glad it worked.
Apr 19 '07 #4

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

Similar topics

1
by: Mats Bue | last post by:
Hi I am working on an application where I need to parse C# source code. For example, I need to find the return statement in a method. So I search for the word "return" in a line of code. But the...
2
by: m | last post by:
hi all, got an interesting problem: im working with purchase orders and in detail line i have a date field. so for example: header line: PO code: X123 PO value: ...
7
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
3
by: linguae | last post by:
Hello. In my C program, I have an array of character pointers. I'm trying to input character strings to each index of the character pointer array using scanf(), but when I run the program, I get...
2
by: George | last post by:
The flow of my app is as follows 1) Pull up an order and change the quantity of a textbox item. (Ex: change the quantity from 1 to 2 2) Click on the Update button 3) When the page posts back you...
7
by: James | last post by:
Hi Has anybody had any experience of ASP.Net performance counters not updating. In the performance monitor application when I try to add the groups ASP.NET and ASP.NET Applications the...
4
by: directory | last post by:
hey guys, I've got a weird one for ya....i have a form which takes user input in the form of textbox's etc. It then grabs some details from a file and updates some of the labels with some info...
0
by: preeti13 | last post by:
i have a two tables employeenominations and reason if someone storing a data first time it will store into the employeenominations table if name is already exist it will store into the reason table...
84
by: braver | last post by:
Is there any trick to get rid of having to type the annoying, character-eating "self." prefix everywhere in a class? Sometimes I avoid OO just not to deal with its verbosity. In fact, I try to...
4
by: AlexNunley | last post by:
I've adopted a moderately sized (65k records) active use database (Access 2000, Windows XP). One of the most commonly used forms is whats called the RMA generation field, used to add claim...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
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,...
0
isladogs
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...

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.