T
Thomas [PBD]
Hello all:
I am having an issue with programming a VBA code to use input boxes, pull
the beginning and ending dates of a month, in order to import a Database
Table. Coding looks right to me, but gives an error stating:
"You cancelled the previous operation" Error 2001 and highlights begwk
criteria.
Sub Append_OH()
Dim month As String
Dim year As String
Dim begwk As String
Dim endwk As String
month = InputBox("Enter Month Name (ex December)", "Enter Month")
year = InputBox("Enter Fiscal Year (ex 2008)", "Enter Year")
begwk = DMin("[Date]", "Week Numbers", "[Month]=" & month & " and [Fiscal
Year]=" & year)
endwk = DMax("[Date]", "Week Numbers", "[Month]=" & month & " and [Fiscal
Year]=" & year)
DoCmd.TransferDatabase acImport, "Microsoft Access",
"\\Filespk01\cars\future32\overheadnew\databackup.mdb", acTable, "400_" &
begwk & " thru " & endwk, "GWL", False
End Sub
Any help would be greatly appreciated.
I am having an issue with programming a VBA code to use input boxes, pull
the beginning and ending dates of a month, in order to import a Database
Table. Coding looks right to me, but gives an error stating:
"You cancelled the previous operation" Error 2001 and highlights begwk
criteria.
Sub Append_OH()
Dim month As String
Dim year As String
Dim begwk As String
Dim endwk As String
month = InputBox("Enter Month Name (ex December)", "Enter Month")
year = InputBox("Enter Fiscal Year (ex 2008)", "Enter Year")
begwk = DMin("[Date]", "Week Numbers", "[Month]=" & month & " and [Fiscal
Year]=" & year)
endwk = DMax("[Date]", "Week Numbers", "[Month]=" & month & " and [Fiscal
Year]=" & year)
DoCmd.TransferDatabase acImport, "Microsoft Access",
"\\Filespk01\cars\future32\overheadnew\databackup.mdb", acTable, "400_" &
begwk & " thru " & endwk, "GWL", False
End Sub
Any help would be greatly appreciated.