Combo Box problem

  • Thread starter Thread starter Bruce Rodtnick
  • Start date Start date
B

Bruce Rodtnick

I have a combo box with a row source from a table (TapeName), using an ID (autonumber) and a name (text), so I have two columns in the query.  I've set the column count to 2 and the column widths to 0";5".  The bound column is 1.

The control source is to a second table (Tapes) and is a text field.  I'm using DLookup to populate four other combo & text boxes which ends up in the and that works fine.  A text box is populated by the ID and in the new table, the ID is a number field.

But when I run the form I get an error:
The value you entered isn't valid for this field.
For example, you may have entered text into a numeric field or a number that is larger than the fieldsize setting permits.

When I change the column widths to 1";5" I don't have the problem, but then the ID is in the combo box and I don't want that.

Why is this happening?

I'm running 2000

Bruce Rodtnick
 
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>

Please turn off HTML posting. Many newsreaders can't handle it, and
many news readers don't like it. (I'll usually delete messages that
just have an HTML icon when I bring up the message, unread, but on a
whim I opened it).
I have a combo box with a row source from a table (TapeName), using an
ID (autonumber) and a name (text), so I have two columns in the query.&nbsp;
I've set the column count to 2 and the column widths to 0";5".&nbsp; The
bound column is 1.

sounds good...
<p>The control source is to a second table (Tapes) and is a text field.&nbsp;
I'm using DLookup to populate four other combo &amp; text boxes which ends
up in the and that works fine.&nbsp; A text box is populated by the ID
and in the new table, the ID is a number field.

Now wait a minute. Three lines up you say the control source is a text
field; here you say the ID number is a number field. Which?
<p>But when I run the form I get an error:
<br>The value you entered isn't valid for this field.

It sounds like you're putting a number into a text field.

Could you post the actual DLookUp expressions? Are you using the
Column() property of the combo box - and taking into account that it
is zero based, so that (2) is the third column of the rowsource query?
 
The info that shows up in the combo box is a text field.&nbsp; I don't know what you're talking about with the column().&nbsp; Could you explain that?

Here's my Dlookup code:

&nbsp;&nbsp;&nbsp; Dim strFilter As String
&nbsp;
&nbsp;&nbsp;&nbsp; ' Evaluate filter before it's passed to DLookup function.
&nbsp;&nbsp;&nbsp; strFilter = "TapeID = " &amp; Me!cboTapeName
&nbsp;
&nbsp;&nbsp;&nbsp; ' Look up product's unit price and assign it to UnitPrice control.
&nbsp;&nbsp;&nbsp; Me!cboTapeName = DLookup("TapeName", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!cboProducer = DLookup("Producer", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!cboVideographer = DLookup("Videographer", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!DateShot = DLookup("DateShot", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!Notes = DLookup("Notes", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!txtTapeID = DLookup("TapeID", "TapeNames", strFilter)

B
&nbsp;

John Vinson wrote: On Thu, 20 Nov 2003 23:36:36 -0600, Bruce Rodtnick
&lt;[email protected]> wrote:
&lt;!doctype html public "-//w3c//dtd html 4.0 transitional//en">
&lt;html>

Please turn off HTML posting. Many newsreaders can't handle it, and
many news readers don't like it. (I'll usually delete messages that
just have an HTML icon when I bring up the message, unread, but on a
whim I opened it).
I have a combo box with a row source from a table (TapeName), using an
ID (autonumber) and a name (text), so I have two columns in the query.&amp;nbsp;
I've set the column count to 2 and the column widths to 0";5".&amp;nbsp; The
bound column is 1.

sounds good...
&lt;p>The control source is to a second table (Tapes) and is a text field.&amp;nbsp;
I'm using DLookup to populate four other combo &amp;amp; text boxes which ends
up in the and that works fine.&amp;nbsp; A text box is populated by the ID
and in the new table, the ID is a number field.

Now wait a minute. Three lines up you say the control source is a text
field; here you say the ID number is a number field. Which?
&lt;p>But when I run the form I get an error:
&lt;br>The value you entered isn't valid for this field.

It sounds like you're putting a number into a text field.

Could you post the actual DLookUp expressions? Are you using the
Column() property of the combo box - and taking into account that it
is zero based, so that (2) is the third column of the rowsource query?

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; John W. Vinson[MVP]
&nbsp;&nbsp;&nbsp; Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&amp;access=public
 
The info that shows up in the combo box is a text field.&nbsp; I don't
know what you're talking about with the column().&nbsp; Could you explain
that?
<p>Here's my Dlookup code:
<p>&nbsp;&nbsp;&nbsp; Dim strFilter As String

Please post this in a readable form and I'll try to help.
 
Let me start over.

I have a combo box with a row source from a table (cboTapeName).&nbsp; The combo box has a row source from a table, TapesNames, with two columns, TapeID (autonumber) and TapeName (text)&nbsp; I've set the column count to 2 and the column widths to 0";5".&nbsp; The bound column is 1.

I'm using DLookup to populate four other combo &amp; text boxes:

Private Sub cboTapeName_AfterUpdate()
Dim strFilter As String
&nbsp;
&nbsp;&nbsp;&nbsp; ' Evaluate filter before it's passed to DLookup function.
&nbsp;&nbsp;&nbsp; strFilter = "TapeID = " &amp; Me!cboTapeName
&nbsp;
&nbsp;&nbsp;&nbsp; ' Look up product's unit price and assign it to UnitPrice control.
&nbsp;&nbsp;&nbsp; Me!cboTapeName = DLookup("TapeName", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!cboProducer = DLookup("Producer", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!cboVideographer = DLookup("Videographer", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!DateShot = DLookup("DateShot", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!Notes = DLookup("Notes", "TapeNames", strFilter)
&nbsp;&nbsp;&nbsp; Me!txtTapeID = DLookup("TapeID", "TapeNames", strFilter)
&nbsp;

But when I run the form I get an error:
The value you entered isn't valid for this field.
For example, you may have entered text into a numeric field or a number that is larger than the fieldsize setting permits.

When I change the column widths of the combo box (cboTapeName) to 1";5" I don't have the problem, but then the ID shows in the combo box and I don't want that.

Why is this happening?

I'm running 2000

Bruce Rodtnick
&nbsp;

John Vinson wrote: On Fri, 21 Nov 2003 06:54:59 -0600, Bruce Rodtnick
&lt;[email protected]> wrote:
The info that shows up in the combo box is a text field.&amp;nbsp; I don't
know what you're talking about with the column().&amp;nbsp; Could you explain
that?
&lt;p>Here's my Dlookup code:
&lt;p>&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strFilter As String

Please post this in a readable form and I'll try to help.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; John W. Vinson[MVP]
&nbsp;&nbsp;&nbsp; Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&amp;access=public
 
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

Bruce, I'm sorry. But I use Agent to read newsgroup messages. It shows
your message as a small icon indicating that it is an HTML file.

I could read it with some hassle... BUT I WON'T.

Please start a new thread if you want someone more tolerant of HTML to
reply, or post in text rather than in HTML, because I simply don't
want to take the time to open a web browser for messages with text
content.
 
Back
Top