473,670 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combo boxes inconsistant behaviror using selStart

I have three combo boxes on a subform. I have tried setting them up so
that when the user clicks in the combo box the curser moves to the
left. I have searched the posts and can find nothing that answers my
problem....no matter what I have tried....on click, set focus, got
focus...one combo box works and the other two start one space from the
left....now if the user tabs, of course they all work...and if you've
clicked anywhere else on the sub form they all work...BUT when you
first open the form or if you refresh, then the same two don't work.
One of the none working combo boxes is social security number, which
has an input mask, but in the underlying query I have now created a
field from ssn and that field does not have an input mask...still won't
work. As far as I can see and I've done a lot of looking, the
properties on the boxes are the same.... am I blind and can't see
what's different. I have spent several hours on several occasions on
trying to fix this. Oh by the way it's Access 2002.
I'm sure hoping the gurus around here have a clue...I hate to tell my
boss I can't find the problem.
Thanks for your time and attention.
Debbie

Jan 21 '07 #1
5 2731
debbie wrote:
I have three combo boxes on a subform. I have tried setting them up so
that when the user clicks in the combo box the curser moves to the
left. I have searched the posts and can find nothing that answers my
problem....no matter what I have tried....on click, set focus, got
focus...one combo box works and the other two start one space from the
left....now if the user tabs, of course they all work...and if you've
clicked anywhere else on the sub form they all work...BUT when you
first open the form or if you refresh, then the same two don't work.
One of the none working combo boxes is social security number, which
has an input mask, but in the underlying query I have now created a
field from ssn and that field does not have an input mask...still won't
work. As far as I can see and I've done a lot of looking, the
properties on the boxes are the same.... am I blind and can't see
what's different. I have spent several hours on several occasions on
trying to fix this. Oh by the way it's Access 2002.
I'm sure hoping the gurus around here have a clue...I hate to tell my
boss I can't find the problem.
Thanks for your time and attention.
Debbie
I think that your input mask is causing the problem. Is the input mask
placing an initial space into the table? One way to solve this is to
remove the input mask on SSN and filter out any nondigits that get
entered when saving it to the table. You can always format the SSN
when you need to display it. I also think that your idea of using
SelStart to get the behavior the way you want when using an input mask
is correct. See:

http://groups.google.com/group/micro...b8f5b992c1b5d4

To filter out the nondigits you can adapt the following module function
to your needs:

Public Function Printable(varIn As Variant) As String
Dim strTemp As String
Dim strChar As String
Dim lngI As Long
Dim lngLen As Long

Printable = ""
If IsNull(varIn) Then Exit Function
If varIn = "" Then Exit Function
lngLen = Len(varIn)
strTemp = ""
For lngI = 1 To lngLen
strChar = Mid(varIn, lngI, 1)
If Asc(strChar) <= 126 And Asc(strChar) >= 32 Then
strTemp = strTemp & strChar
End If
Next lngI
Printable = strTemp
End Function

Note that the digits 0 through 9 are the ASCII values 48 through 57.

Since I'm already at this point (untested):

Public Function DigitsOnly(varI n As Variant) As Variant
Dim strTemp As String
Dim strChar As String
Dim lngI As Long
Dim lngLen As Long

DigitsOnly = Null
If IsNull(varIn) Then Exit Function
DigitsOnly = ""
If varIn = "" Then Exit Function
lngLen = Len(varIn)
strTemp = ""
For lngI = 1 To lngLen
strChar = Mid(varIn, lngI, 1)
If Asc(strChar) >= 48 And Asc(strChar) <= 57 Then
strTemp = strTemp & strChar
End If
Next lngI
DigitsOnly = strTemp
End Function

Then your update query will look something like (with MyTable replaced
by your table name):

UPDATE MyTable SET SSN = DigitsOnly(SSN) ;

If you are using a bound form and need to see the formatting, you may
have to live with the input mask or have a separate unbound textbox
that controls a hidden bound textbox. Note that to do this you'd also
need to fill the unbound textbox in the form's On Current event and
update the bound textbox in the unbound textbox's AfterUpdate event,
using DigitsOnly to place the formatted unbound textbox's value into
the bound textbox as an unformatted string. Perhaps commit the change
in the same AfterUpdate event. The hidden bound textbox should not
have an input mask. Hopefully, some of these ideas will help you find
a solution.

James A. Fortune
CD********@Fort uneJames.com

Jan 21 '07 #2
CD********@Fort uneJames.com wrote:
If you are using a bound form and need to see the formatting, you may
have to live with the input mask or have a separate unbound textbox
that controls a hidden bound textbox. Note that to do this you'd also
need to fill the unbound textbox in the form's On Current event and
update the bound textbox in the unbound textbox's AfterUpdate event,
using DigitsOnly to place the formatted unbound textbox's value into
the bound textbox as an unformatted string. Perhaps commit the change
in the same AfterUpdate event. The hidden bound textbox should not
have an input mask. Hopefully, some of these ideas will help you find
a solution.
One more thing. Look at help for the Input Mask Property's ability to
store either the literal string or the input string. That might give
you another option.

James A. Fortune
CD********@Fort uneJames.com

Jan 21 '07 #3

Thanks so much for your quick response. I agree now that I should have
stored the ssn without the dashes. And I will use the code you have
provided for fixing that issue. However I had two combos that didn't
work and the other one had no input mask. I did check and there are no
spaces in the data. But I did take another look at what is different
between the one that works and the two that don't. They each have
their own query, but the two that don't work are using a field besides
the primary key to find a record based on the selection in the combo
box. There could be multiple answers but we are fine with finding the
first one.....Any ho....I added the primary key to the non-working
combos and made it the bound field....and now the combos work.

I don't understand why they work....what would it matter which field we
search on...why now does matter to the selstart = 0 in the got focus of
the combo.

Again don't know why it works, would love to understand it, but thought
it might help someone else....
and why after all this time, and finally posting do I get it figured
out.

Thanks again, as I will use the code you provided, and I'm sure others
will, too. I'm always finding some piece of code to use in some older
postings.

Deb

Jan 21 '07 #4
debbie wrote:
Thanks so much for your quick response. I agree now that I should have
stored the ssn without the dashes. And I will use the code you have
provided for fixing that issue. However I had two combos that didn't
work and the other one had no input mask. I did check and there are no
spaces in the data. But I did take another look at what is different
between the one that works and the two that don't. They each have
their own query, but the two that don't work are using a field besides
the primary key to find a record based on the selection in the combo
box. There could be multiple answers but we are fine with finding the
first one.....Any ho....I added the primary key to the non-working
combos and made it the bound field....and now the combos work.
I'm glad you have them working. Be sure to include WHERE fieldname IS
NOT NULL in your combobox queries. Nulls in the return set can
interfere with the combobox's Auto Expand functionality. I think this
is because of the way Access tests for equality to Null values.
>
I don't understand why they work....what would it matter which field we
search on...why now does matter to the selstart = 0 in the got focus of
the combo.
I can't tell from my vantage point why the search field changes things.
I think SelStart = 0 works because comboboxes seem to treat Input Masks
almost as part of the value even when you make it clear that they're
not to be taken literally. Without the Input Mask I don't see how
you're getting an initial space. Is it possible that your query based
on existing form values somehow puts an unintentional space into an
expression?
>
Again don't know why it works, would love to understand it, but thought
it might help someone else....
and why after all this time, and finally posting do I get it figured
out.
People figure out answers when they post because it puts irony on their
side :-).
>
Thanks again, as I will use the code you provided, and I'm sure others
will, too. I'm always finding some piece of code to use in some older
postings.
Not all the information I post is so great, but I have my moments. I'm
thinking of saving every post I make because some old posts of mine
seem to be dropping off and I have no control over how long posts get
saved.
>
Deb
James A. Fortune
CD********@Fort uneJames.com

Jan 21 '07 #5
"debbie" <de****@seaport net.comwrote in message
<11************ **********@m58g 2000cwm.googleg roups.com>:
I have three combo boxes on a subform. I have tried setting them up
so that when the user clicks in the combo box the curser moves to the
left. I have searched the posts and can find nothing that answers my
problem....no matter what I have tried....on click, set focus, got
focus...one combo box works and the other two start one space from
the left....now if the user tabs, of course they all work...and if
you've clicked anywhere else on the sub form they all work...BUT when
you first open the form or if you refresh, then the same two don't
work. One of the none working combo boxes is social security number,
which has an input mask, but in the underlying query I have now
created a field from ssn and that field does not have an input
mask...still won't work. As far as I can see and I've done a lot of
looking, the properties on the boxes are the same.... am I blind and
can't see what's different. I have spent several hours on several
occasions on trying to fix this. Oh by the way it's Access 2002.
I'm sure hoping the gurus around here have a clue...I hate to tell my
boss I can't find the problem.
Thanks for your time and attention.
Debbie
For selstart to occur when clicking on the control, did you also try
setting .SelStart = 0 in the On Mouse Up event of the control?

--
Roy-Vidar
Jan 21 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2859
by: Newsgroup | last post by:
I have a multiline textbox with 10 lines of text in it. I want to search Line by Line for the word" ". How do I process one line in a text box at a time? I DON'T want to just search the whole textbox for my word, because when I find it, I want to stop the cursor there until the user decides to continue to find the next instance. MY QUESTION IS: How can I search for text line by line in a textbox? Thank You, Paul
1
3318
by: FZ | last post by:
Hi Gang, I was wondering if a generous person might be able to walk me through what I believe is a pretty simple task. I actually have significant Access experience, but I haven't done it in about 3 years and I'm more rusty than I thought I was. Anyway, in a nutshell: The scenario: 2 combo boxes (comboLastName and comboStateorProvince) on a form with 30 text boxes, the form's recordsource has been set to a query, both combo boxes and...
3
8205
by: Bob Alston | last post by:
I am using a combo box to select the key to records and then go to the selected record on my form. Works well. However, the list, which contains people names, is rather long. What I would like to do is to allow entry of one or more letters of the beginning of the last name, like "j" for someone named Johnson (or Johnston) , where the list in the combo box will only show names equivalent to a "like {j*}" clause. So far it appears...
5
3695
by: jjyconsulting | last post by:
Newbie needing some help. I have a tblParticipants. The fields include gender, education_level, income, occupation etc., I'm trying to create a form where a user can run a query from the form and just choose the appropriate criterias from the combo boxes to get the results. I also want the query to run even if there is not a value in all the combo boxes ie., i want just all males with income level of over $100,000...Any insights or help...
6
3674
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
2905
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a main form (RD Form) with 4 combo boxes (i.e. cbo1, cbo2, etc) and a subdatasheet (the subform...let's call it subInfo) below the combo boxes on the RD Form. I hope this eliminates any confusion of the
2
3267
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once selecting from the combo box, I have all the combo boxes, using afterupdate, populating their respective list boxes. These text boxes are directly correlated to the combo box selection using SQL. Here is an example from the afterupdate event in the...
9
2915
by: prakashwadhwani | last post by:
I have an unbound combo box in the form header. I have used an input mask "CCCC" 40 times to limit the max number of characters to 40. When I tab into the combo box & press a character say "K" for example, the entire first match gets filled in the combo box and the cursor goes to the last character of the combo box. So I can't effectively search for a "KI" until I backspace the entire entry which has got filled in. Once i remove the...
0
8471
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, 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...
0
8817
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8593
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,...
0
8663
tracyyun
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...
0
7423
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, 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...
0
5687
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();...
0
4215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4396
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2804
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.