Setting Text property of textbox used for dataType of Memo

R

RG

I have a table consisting of the following:

ID - AutoNumber
EventCode - Memo

I created a form based on this table.

In the EventCode textbox on my form, I can paste many characters (I'm
assuming up to 64K, but most I've needed was 10K)

In my VB Code I do the following:

EventCode.Text = sCode

sCode is about 3000 characters, but can grow or shrink.

This works:
EventCode.Text = Left(sCode, 2048)

This will fail
EventCode.Text = Left(sCode, 2049)

But I can paste more than much more than 2049 characters into the EventCode
textbox without any issue.

So what I am I missing?
How can I programatically set EventCode.Text with more that 2048 characters?

Thanks
 
M

Marshall Barton

RG said:
I have a table consisting of the following:

ID - AutoNumber
EventCode - Memo

I created a form based on this table.

In the EventCode textbox on my form, I can paste many characters (I'm
assuming up to 64K, but most I've needed was 10K)

In my VB Code I do the following:

EventCode.Text = sCode

sCode is about 3000 characters, but can grow or shrink.

This works:
EventCode.Text = Left(sCode, 2048)

This will fail
EventCode.Text = Left(sCode, 2049)

But I can paste more than much more than 2049 characters into the EventCode
textbox without any issue.


Why are you using the Text property? I don't have an answer
to your question, because that's not how things are normally
done in Access. In Access, unlike VB forms, the Text
property is only used in special cases where you need to
distinguish between the existing value and an incomplete
value currently in the process of being entered,

Try changing your code to:

Me.EventCode = Left(sCode, 2049)
 
R

RG

That was the problem. I have never used VBA before, and assumed that .Text
was used like VB.

Thanks Marshall
 

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