Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox won't respond to zero as first char. in string: Simple Fix? 1

Status
Not open for further replies.

kjschmitz

Technical User
Feb 4, 2008
26
US
Pardon my ignorance, I have been trying to develop a database for my department (well beyond my training) and I have come across a small issue:

I use a combobox (cboProjNumber) in the header of a form (frmStaffUpdateProj) in order to allow users to select a record to edit . It works fine the way it is coded:

Code:
Private Sub cboProjNumber_AfterUpdate()
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[ProjectNumber] = '" & Me![cboProjNumber] & "'" 
    ' Find the record that matches the Project Number specified.'
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

The only issue I have is that if the user wishes to type in the project number it will not respond to entering a zero as the first character (ex. 07-135)

The field ProjectNumber is a text field, as some project "numbers" may eventually get assigned a,b,c, etc values.

The Project Number field is also the primary key in my table.

Here is some additional information:

cboProjNumber Properties:

Input Mask ... 99\-999;0;*
Row Source Type ... SELECT tblProjectList.ProjectNumber FROM tblProjectList;
Limit to List ... Yes

Anymore information you need please don't hesitate to ask. These forums have been immensely helpful to me, and I appreciate all of your thoughts on the matter. Thanks in advance,

Kiel S.


 
I have a combobox that has items in the form of 04-1234, etc. and it's working fine. Two things:
Is your combobox bound or unbound?
The field for your combobox is defined in your table as text. But your input mask has it as numeric. Get rid of the input mask. You really don't need it since you have Limit to List as yes. No one can type in any data.
 
Thanks for the quick reply. The combobox is currently unbound. And your fix worked perfectly. Again, thanks, and have a star :)
 
One quick follow-up question: is there anyway to allow the user to input a project number and have it automatically add the dash (07-123) while entering the field to call the record without the input mask?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top