Thanks, I learned some basic vb now. so you used &strStart& to instead of the years(2013)? I should type B1.[MAT Jan"&strStart&"_Sale]=N1.MAT Jan"&strStart&"_sale], right?
The & is concatenation operator. strStart is a variable. This is how strings are built using literal text and variables.
Exactly where did you put the code - is it behind a form or in a general module? Should be behind form that has the controls. Listbox or combobox or textbox - doesn't matter.
You need an understanding of basic programming concepts if you are going to pursue db customization with VBA.
http://holowczak.com/programming-con...l-programmers/
Here is a VBA tutorial. http://www.access-vba.net/introducti...ccess-vba.html
Also, I want to the btnUpdate to achieve this function, so I just type code in btnUpdate?
Select [Event Procedure] in the button Click event then click the ellipsis (...) to open VBA editor at the event procedure. Type code there.
Need space before and after &.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.