
Originally Posted by
June7
You need some control to input the year parameter. Then reference that control in the VBA to construct appropriate SQL action statement. I have provided sample code. Now adapt it to your db.
Advise no spaces or special characters/punctuation (underscore is exception) in names.
First, thanks a lot. BTW, I use the listbox instead of the combox. Is it matter?
Code:
Dim strStart As String strStart = Val(Me.List4)
CurrentDb.Execute "UPDATE N1 INNER JOIN B1 ON N1.NDC=B1.NCD SET B1.[" & strStart & " sale] = N1.[" & strStart & " sale], B1.[" & strStart + 1 & " sale] = N1.[" & strStart + 1 & " sale], B1.[" & strStart + 2 & " sale] = N1.[" & strStart + 2 & " sale]"
when I run it, why it said "Me" is invalid? I am sorry because I just start to learn the access and vb code. What stand for "&strStart&" sale?