Form Text Box Not Writing Data To A Table

lhooker

Registered User.
Local time
Today, 01:30
Joined
Dec 30, 2005
Messages
423
Can anyone tell me what's wrong with the below statement ? I'm trying to pull the contents from a text box in a form. The text box is supposed write the contents to a field (memo data type) in a table. Thanks ! ! !


strComments = Forms![Payroll History]![Comments].Column(0)
 
It looks like you are just assigning the value of Comments to an internal variable in the procedure.

You should be assigning the value to a field on the form that is bound to the table.

E.g.

Me.txtComments = Forms![Payroll History]![Comments].Column(0).

Also, use MsgBox to display the value of strComments. I'm not clear on the Column(0) notation and don't know if that is causing you a problem.

-g
 
-g,

Me.strComments = Forms![Payroll History]![Comments].Column(0)

Receieved a compile error (i.e. "Method or data member not found (Error 461)") on the above statement. What do you think is causing the error ?
 
Hi hooker, oops..., lhooker,

Based on the way you name your variable, strComments seems to be an internal variable (agree with -g). Therefore, using Me.internalVariable will give you that error message because I can't find that field on your form. So whatever name of the column (in your table) that you want to add the comment to, is it bounded to a field on your form? Whatever that field is, follow -g's comments: do a Me.field = ....
 
Supercharge,

So much for the jokes . . . Hey, I'm still getting an error. The message is below. When I hover over the "Me.Comments", I do see the value from the text box. By the way, the text box data type is "Memo". Does this make a difference ?


Object doesn't support this property or method (Error 438)


Me.Comments = Forms![Payroll History]![Comments].Column(0)
 
Unless the Comments control is a ComboBox or a ListBox, it will not support the Column property!
 
RuralGuy,

How can I retrieve the data in this text box (that has a data type of "Memo") ? As stated, I do see the value from the text box (in debug mode). So, it's there . . .
 
Last edited:
I might start by asking why you are trying to copy the memo field. That would put that data in more than one table in the db, which is a violation of normalization rules. Why not just join the table to the Underlying query and just display the field?
 
RuralGuy,

I want to capture the data in the text box ("Memo" field) for a report. The data entered is added to the comment section of a report.
 
Is the report based on a query that includes the Memo field? If not, can you add the table to the query so you can display the Memo field?
 
RuralGuy,

The report is based on a table and it has sub-reports that also depends on other tables.
 
Sorry but I've been gone all day. Can you base the report on a query instead that includes the Memo field table?
 
RG,

I tried using a query, but it affected other parts of this report. The sub-reports use separate tables. Let me take another look at the design of this report. I'll get back to you. Thanks ! ! !
 
RG,

I think I got it. I removed "Column(0)" from the below statement. It appears to be working. The new statement is shown below:

strComments = Forms![Payroll History]![Comments]

Unfortunately, I broke something else. I'm not sure if this has anything to do with this, but there is a date field (text box) that was writing to the same table. This date is entered by the user from the form. Now, it does not write the date to the table. Both fields write to the same table. Do you think it's trying to write the data at the same time and MS Access is not allowing this to happen because both fields are trying to write to the same table at the same time ? Thanks ! ! !
 

Users who are viewing this thread

Back
Top Bottom