Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / July 2007

Tip: Looking for answers? Try searching our database.

display and store values in a textbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ToyFixer - 25 Jul 2007 17:20 GMT
I want to display the Cost Centre in a text box on a data entry from and when
the user saves the record, I want it to be recorded in the relevant field.
This Cost Centre is selected from a combo box on a login form and it is being
passed on to the text box of the data entry form.

I know that this topic has been discussed previously and usually the
inquirers are adviced to use a subform or not to re-save the data. But in my
case both options are not possible.

I set up a dummy text box and used the following code to write data to the
relevant field.(with control source of txtDummy set to the relevant field in
the table). However, it doesn't seem to work.

Private Sub Form_BeforeUpdate(Cancel as Integer)
Me!txtDummy = Me!txtCostCentre
End Sub

I tried to use .text and .value properties of the control to do it but it
doesn't seem to write the value to the table. I get an error message saying
the field cannot have a null value because I have set 'required' to true.

Please help me on this. I am desperate and wasted about two days trying to
get around this problem.

Thanks
Toyfixer
Mr B - 25 Jul 2007 20:22 GMT
ToyFixer,

If I understand your situation correctly, you are trying to have the value
in the "txtCostCentre" control to be assigned to be the value fo the
"txtDummy" control.  From your description, it appears that these controls
are on different forms.

If this is true, then you will need to provide the complete identification
for the control on the other form. Something like:

Forms!formNameHere!txtDummy = me.txtCostCentre

Signature

HTH

Mr B

> I want to display the Cost Centre in a text box on a data entry from and when
> the user saves the record, I want it to be recorded in the relevant field.
[quoted text clipped - 22 lines]
> Thanks
> Toyfixer
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.