Access Table Query, Not Displaying Full Table Cell

opioid

New member
Local time
Today, 11:46
Joined
Aug 3, 2004
Messages
6
:confused:

Hi, I'm using Access to pull the first few characters of a field from a table, and put them in a combo box. Users can then select from one of those values, hit submit, and then the full text of the index appears in the adjacent text box.

Fields are:
Command1
Combo1
Text1

Database is: "uncanny"

Code:


Code:
Private Sub Command1_Click()
    Dim can As String
    Combo1.SetFocus
    can = Combo1.text

    Text1.SetFocus
    Text1.text = can
    Text1.Enabled = True

    

End Sub
'
Private Sub Command120_Click()
    ' clear text box
    Text1.SetFocus
    Text1.text = (" ")
End Sub

What is the code for displaying column1 of uncanny in the combo box, being able to click that value, and then having the concatenated values of columns one and two appear in the text box? I have an auto-numbered index in my table. I hope this is clear.

Opio
 
opio,

The combobox should have something like this as
a rowsource:

Select FieldA, FieldB From SomeTable ...

Set properties for the combo:
NumberColumns = 2
Width = 1";0"

Then in the AfterUpdate event of the combo:

Me.SomeTextBox = Me.Combo.Column(0) & Me.Combo.Column(1)

or with punctuation:

Me.SomeTextBox = Me.Combo.Column(0) & " " & Me.Combo.Column(1)

Or carriage return:

Me.SomeTextBox = Me.Combo.Column(0) & vbCrLf & Me.Combo.Column(1)

Wayne
 
re: help

Thank you Wayne!

But I am unable to understand exactly how you make it work?! The method you suggest returns "Cannot find macro Me...."

I'm confused? I thought I did everything right? I was able to get this to work earlier with a list box going to a textbox by using the following structure:

Listbox row source:
SELECT uncanny.Messages FROM uncanny ORDER BY ID;

Textbox control source:
=[ListBox111].[Column](0)

That works, but only returns 255 characters. I have created my tables with Memo types, so I didn't think that limit would be an issue. Is there a way to make that structure return the entire database field, and not just the first few characters?

I would appreciate any further assistance that you are willing to lend. Thank you again.

-Opio
:) :)


[edit: It is entirely possible that i am placing =Combo123.Column(0) & vbCrLf & Combo123.Column(1) in the wrong place. I be your forgiveness; I am quite unfamiliar with Access!]
 
Last edited:
255 character limit.

Ok, got it working, but.... only displays 255 characters. Anyone know why? I have set the fields to memo.
 
Maybe you can lose this kind of ref:

me.Text1.text

Just use:

me.Text1

???
ken
 
Memos only display the first 255 characters in tables/queries/datasheets.
 
Mile-o-phile,

Do you know any way around this snafu? Put another way, how can I data greater than 255 characters in length out of a table and have it display in a textbox?

Thanks for all the responses!
 
Sheepishly... Could you explicate for this newbie how you "query as normal and bind my query to the form?" :rolleyes:
 

Users who are viewing this thread

Back
Top Bottom