Good day,
Back ground: I’m working on a database that tracks packaging contents and assigns a number to them. The package number is just the simple auto number and the year so, 1/2004, 2/2004 and so on. The only part I haven’t figared out is having the user have the database to another location at the end of the year by pressing a button on the form they use.
1) I haven’t sorted out yet is the creating a new database until I saw bat17’s post with this code:
Function CreateNewDB()
Dim wrk As Workspace
Dim dbNew As Database
Dim strName As String
Dim strDefault As String
strDefault = "Accounts" & Format(DATE, "YYYYMMDD")
strName = InputBox("Enter name for new Database", "Database Name", strDefault)
If strName = "" Then Exit Function ' action canceled
Set wrk = DBEngine.Workspaces(0)
Set dbNew = wrk.CreateDatabase("C:\My Documents\" & strName & ".mdb", dbLangGeneral, dbEncrypt)
Set dbNew = Nothing
End Function
But once I input the code in Access 2000 on Windows 2000 and XP pro I get the following error message
Compile error :
Ambiguous name detected : CreateNewDB
2) How do I go about changing the same location from something changeable by a user. I would love to be able to do this in a text box on a form where they enter the rest of the information.
Thanks in advance
Back ground: I’m working on a database that tracks packaging contents and assigns a number to them. The package number is just the simple auto number and the year so, 1/2004, 2/2004 and so on. The only part I haven’t figared out is having the user have the database to another location at the end of the year by pressing a button on the form they use.
1) I haven’t sorted out yet is the creating a new database until I saw bat17’s post with this code:
Function CreateNewDB()
Dim wrk As Workspace
Dim dbNew As Database
Dim strName As String
Dim strDefault As String
strDefault = "Accounts" & Format(DATE, "YYYYMMDD")
strName = InputBox("Enter name for new Database", "Database Name", strDefault)
If strName = "" Then Exit Function ' action canceled
Set wrk = DBEngine.Workspaces(0)
Set dbNew = wrk.CreateDatabase("C:\My Documents\" & strName & ".mdb", dbLangGeneral, dbEncrypt)
Set dbNew = Nothing
End Function
But once I input the code in Access 2000 on Windows 2000 and XP pro I get the following error message
Compile error :
Ambiguous name detected : CreateNewDB
2) How do I go about changing the same location from something changeable by a user. I would love to be able to do this in a text box on a form where they enter the rest of the information.
Thanks in advance