Text Box not listing all data

G

Guest

I have a text box on my form which is populated based on a selection made in
a combobox. I have used the VBA code below and it does to work to some
extent however not all of the text is showing. I have verified that the size
for the underlying tables are set to maximum (255) but to no avail. Can
someone please help?

Private Sub ServiceID_AfterUpdate()
Dim strfilter As String

On Error GoTo errorhandler


Me.Description = serviceid.column(3)
Exit Sub

errorhandler:
MsgBox "Error#" & Err.Number & vbCrLf & Err.Description
 
J

John W. Vinson

I have a text box on my form which is populated based on a selection made in
a combobox. I have used the VBA code below and it does to work to some
extent however not all of the text is showing. I have verified that the size
for the underlying tables are set to maximum (255) but to no avail. Can
someone please help?

Private Sub ServiceID_AfterUpdate()
Dim strfilter As String

On Error GoTo errorhandler


Me.Description = serviceid.column(3)
Exit Sub

errorhandler:
MsgBox "Error#" & Err.Number & vbCrLf & Err.Description

What's the RowSource of the ServiceID combo? Please post the SQL. What's the
datatype and size of the fourth field in the rowsource query? What are you
seeing, and what do you expect to see?

If the fourth field is a Memo field it will be truncated in the combo box;
might that be the problem? An alternative would be

Me.Description = DLookUp("[descriptionfieldname]", "[tablename]", _
"[ServiceID] = " & Me.ServiceID)

John W. Vinson [MVP]
 
G

Guest

I used your suggestion however the problem persist. The source table
(tblService) is set as a text field with the length set to 255. Here is the
rowsource for the cmbService:

SELECT tblservice.serviceID, tblservice.Service, tblservice.CategoryID,
tblservice.Description FROM tblService WHERE
(((tblService.CategoryID)=[]![CategoryID]));

In terms of my code, I have specified a variable (strfilter) as string.
Should I define strfiler in the code (eg: strfilter= "ServiceID=" &
me.serviceid)

Z


John W. Vinson said:
I have a text box on my form which is populated based on a selection made in
a combobox. I have used the VBA code below and it does to work to some
extent however not all of the text is showing. I have verified that the size
for the underlying tables are set to maximum (255) but to no avail. Can
someone please help?

Private Sub ServiceID_AfterUpdate()
Dim strfilter As String

On Error GoTo errorhandler


Me.Description = serviceid.column(3)
Exit Sub

errorhandler:
MsgBox "Error#" & Err.Number & vbCrLf & Err.Description

What's the RowSource of the ServiceID combo? Please post the SQL. What's the
datatype and size of the fourth field in the rowsource query? What are you
seeing, and what do you expect to see?

If the fourth field is a Memo field it will be truncated in the combo box;
might that be the problem? An alternative would be

Me.Description = DLookUp("[descriptionfieldname]", "[tablename]", _
"[ServiceID] = " & Me.ServiceID)

John W. Vinson [MVP]
 
J

John W. Vinson

I used your suggestion however the problem persist. The source table
(tblService) is set as a text field with the length set to 255.

That doesn't parse. A *table* might contain a 255 byte text field, but saying
that "the source table is set as a text field" is meaningless. A table isn't a
field and can't be "set as" a field. I just don't understand what you mean
here!
Here is the
rowsource for the cmbService:

SELECT tblservice.serviceID, tblservice.Service, tblservice.CategoryID,
tblservice.Description FROM tblService WHERE
(((tblService.CategoryID)=[]![CategoryID]));

I'm astonished that works at all. What is intended by the peculiar []!
syntax!?
In terms of my code, I have specified a variable (strfilter) as string.
Should I define strfiler in the code (eg: strfilter= "ServiceID=" &
me.serviceid)

What does strFilter have to do with this combo box? Where is the value of
CategoryID supposed to come from? I'm simply not seeing the whole picture
here!


John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top