Duplicating a value from one field to another

Louisa,

Every object in a database has a name, when you design a table you assign field names, if you don't access (depending on which version) will assign them as Field1 etc, in query it is the same, if you build an expression and don't name it, it will assign it a name like Expr1. On a form even if you add a textbox there is a name like text8 and the label also is assigned a name which would be label7 or 9.

I would suggest that you open the form in design view select the properties and then select your total field, you will see it has a name called text8, hence me stating within your proper database you will have to do the same.

I have attached the copy you sent me with the code on the form and you will see that it works fine.

As you have stated you are self taught then perhaps this then adds to your knowledge.
 

Attachments

Thanks Trevor,

Can you advise what this line indicates? Set rst = db.OpenRecordset("Commission", dbOpenTable)

On opening my form i get "Run time error 3219 invalid operation, on hitting debug it takes me to the above line of code. Maybe i have a different name for that section but as you are aware i know nothing on code so if you could explain what it represents?
 
Can you advise what this line indicates? Set rst = db.OpenRecordset("Commission", dbOpenTable)

rst stands for recordset, The table name in your case is Commission and dbOpenTable means open the table.

Can you check that in the VBA screen the reference has been set to use DAO 3.6 Object Library (or the library number you have installed on your machine!)

If this still fails, look back in the thread at the copy and paste option, and hopefully now you understand about the name you can correct that and it may well work for you.
 
i am sorry but i have absolutely no idea where i need to look for this.
 
Use Alt + F11

Then go to Tools and References
 
It is set to DAO 3.6 and i have confirmed all the names of fields, forms etc but it is still bringing up the same error :-(
 
Go back to trying this simpliar code

DoCmd.GoToControl "Project ID"
DoCmd.RunCommand acCmdCopy
Docmd.OpenForm "The form name goes here"
DoCmd.GoToControl "Project ID"
DoCmd.RunCommand acCmdPaste

This is the last possible option I can offer you.
 
Hi Trevor,

After searching online it appears that i cannot use the line "Set rst = db.OpenRecordset("Commission", dbOpenTable)"
This is because my db has been split and i should use the dbOpenDynaset. I am going to give that a try but thought i would thank you for all your help.
 

Users who are viewing this thread

Back
Top Bottom