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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

contents of txt box into combo box *as* the user types them

Status
Not open for further replies.

david2001

Technical User
Oct 2, 2001
24
0
0
GB
Hello,

I need to have what ever the user is typing in "txtbox1" automaticly be entered into cboBox1, *AS* the user types it letter by letter but with out changing the record source and so on of the combo box. They are both on frmForm1.

I know that this may not be the best way of doing things but there are very good reasons why I have to do this (unfortunatly).

Can some one suggest how I may do this as I have spent the last 2 days working on just this one small problem.

Thank you for your time,

david2001
 
Hi Lonine,

I tried it just like you said and nothing happened.

Any ideas ?

Thanks

David2001
 
Hi Lonnie,

My e-mail is david2001@starmail.com.

Regards,

David
 
Hi Lonnie,

Thank you for going to so much trouble for me - I REALLY do apprciate it.

I used the code exactly as you said and I now get a debug box error message:
Run-Time error '-2147352567 (80020009)':
The value you entered isn't valid for this field.

Could this be caused by the way that my combo box looks up its data ??

Thanks again,

David
 
Do you have contraints on your combo box?

Such as...

Input Mask
Limit To List
Validation Rules

If so, then what you are typing in the text box may violate one of these.

Lemmeno... ljprodev@yahoo.com
ProDev, MS Access Applications B-)
 
Hi Lonnie,

Yes, I have limit to list set to yes?

regards,

David
 
Are you doing anything special to the text box?

Also, you mentioned something about the way you are looking up data in the combo box. How is it looking it up?

Are both boxes the same data type? Numbers and text? ljprodev@yahoo.com
ProDev, MS Access Applications B-)
 
Hi Lonnie,

I am not doing anything special that I know of. The combo gets its data using:

Row source = SELECT [tblTrackTitles].[TrackTitleID], [tblTrackTitles].[TrackTitle] FROM tblTrackTitles;

It also has an onchange event:

Private Sub TrackTitle_Change()
Dim txtSearchString As Variant
Dim strSQL As String

txtSearchString = Me![TrackTitle].Text

strSQL = "SELECT DISTINCTROW qryLookupTrackTitles.TrackMainID, qryLookupTrackTitles.TrackTitle, qryLookupTrackTitles.MixTitle, qryLookupTrackTitles.Composer FROM qryLookupTrackTitles "
strSQL = strSQL & "WHERE ((qryLookupTrackTitles.TrackTitle) Like '" & txtSearchString & "*') "
strSQL = strSQL & "ORDER BY qryLookupTrackTitles.TrackTitle, qryLookupTrackTitles.MixTitle"

Me!lstResults.RowSource = strSQL
Me!lstResults.Requery
Me!TrackTitle.SetFocus
End Sub


1stResults is the actual list box that is populated by what ever the user selects in the combo box.

I dont know if that helps or not ?

Regards,

David
 
Hi fellow forum members,

I still need help with this problem if anyone can suggest anything - its really driving me mad. Such a hard thing to do for such a simple task.

Kind regards,

david
 
Hi Lonnie,

Thank you for your kind offer, I have tried to send you a sample DB twice now but each time it gets returned.

The file I am trying to send is just under 3MB - is that too big ???

Let me know,

Regards,

David
 
David,

First things first. In the future, please limit the duplication of posts in multiple forums. You have three other people helping you in the VBA coding forum who don't have the complete info from this one.

Like LonnieJohnson asked above, and I did in the VBA coding forum: Are both boxes the same data type? Numbers and text?
This is the prime cause for the error message
Code:
 The value you entered isn't valid for this field.

Does this code error immediately, or after you enter a few characters?? (i.e. You enter ABC in the text box, you have IDs that start with AB, but you don't have an ID that starts with ABC.) Your SQL will return nothing.
 
Hi CosmoKramer,

Thank you very much for your posting and your comments - I will be sure to consider them in the future.

As you and Lonnie asked, The text box in which I wish to enter the data is a plain "Unbound" text box and the combo box that runs the list box is a bog standard combo.

Yes the error code is generated straight away even before the first letter appears in the combo box. I was using test data that I know is in the list so that the SQL should have returned something.

I do not know if this answers you question or not, but please tell me if not as I am not very good at explaining things that I do not fully understand.

Thank you again for your time,

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top