Hello, first time posting and complete VBA newbie. I've been tasked with creating a "quote database" for my company. I have a database that holds most of the information as well as a form to populate said table. In my system, we have a generic file folder named quote template folder, which gets copied and saved with the new quote number such that for every new quote a new quote folder is saved. I've programmed a button on my form so that when clicked, the code is run to capture that quote number (Primary key of quote database) and create the new folder on the server. The primary key ID is formatted in the way "Q13"000 so Q13 is always in the quote number.
When I click the button on the form I get runtime error 2465 "Microsoft access can't find the field '|1' referred to in your expression. When I debug/step into it fails on the QuoteNumber= line
Any help would be awesome, I've been working at solving this for hours.
QuoteNumber = [ID]
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.copyFolder "\server\Shop Management\active quotes\_Quote File Template", _
"\\server\QTS Shop Management\active quotes\" & QuoteNumber
Set FSO = Nothing
Dim OldName1, NewName1
OldName1 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\Communications": _
NewName1 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\" & QuoteNumber & "_Communications"
Name OldName1 As NewName1
Dim OldName2, NewName2
OldName2 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\Customer Files": _
NewName2 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\" & QuoteNumber & "_Customer Files"
Name OldName2 As NewName2
Dim OldName3, NewName3
OldName3 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\\Quote template.xls":
NewName3 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\" & QuoteNumber & ".xls"
Name OldName3 As NewName3
End Sub
When I click the button on the form I get runtime error 2465 "Microsoft access can't find the field '|1' referred to in your expression. When I debug/step into it fails on the QuoteNumber= line
Any help would be awesome, I've been working at solving this for hours.
QuoteNumber = [ID]
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.copyFolder "\server\Shop Management\active quotes\_Quote File Template", _
"\\server\QTS Shop Management\active quotes\" & QuoteNumber
Set FSO = Nothing
Dim OldName1, NewName1
OldName1 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\Communications": _
NewName1 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\" & QuoteNumber & "_Communications"
Name OldName1 As NewName1
Dim OldName2, NewName2
OldName2 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\Customer Files": _
NewName2 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\" & QuoteNumber & "_Customer Files"
Name OldName2 As NewName2
Dim OldName3, NewName3
OldName3 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\\Quote template.xls":
NewName3 = "\\server\Shop Management\active quotes\" & QuoteNumber & "\" & QuoteNumber & ".xls"
Name OldName3 As NewName3
End Sub