Hi guys,
Well It's almost the beginning of the year and time to swap out those old databases. I have a problem. I am building a replacement Personal Time Off database that will be used in several different location so Problem # 1 is I need to be able to dynamically tell where my database is located. I tried app.path I just got errors so I did this
This gave me the directory where the db lives. Now prob #2 I have to extract information out of an old database to save me from having to go location to location to extract the data manually. So I created a initialization form that pulls info from the old database sort and saves it to the new database. Sound pretty easy.(Yep I thought so to). Now I get the dreaded error 13 type mismacth here is what I have:
This seems to work ok but when I get to :
I get an error type mismatch 13. Debug hilites the amperstand. My question is how do I set the dbYearEnding Reference without using strings? I am not sure what others have installed on their workstations so I have to keep my references to a bare minimuml.
I do appologize for the length of this post. Any replies will be appreciated
Thanks
Scoty :
"Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),
Well It's almost the beginning of the year and time to swap out those old databases. I have a problem. I am building a replacement Personal Time Off database that will be used in several different location so Problem # 1 is I need to be able to dynamically tell where my database is located. I tried app.path I just got errors so I did this
Code:
AppPath = CStr(Left(CurrentDb.Name, Len(CurrentDb.Name) - 12))' 12 happens to be the length of the name of my database
This gave me the directory where the db lives. Now prob #2 I have to extract information out of an old database to save me from having to go location to location to extract the data manually. So I created a initialization form that pulls info from the old database sort and saves it to the new database. Sound pretty easy.(Yep I thought so to). Now I get the dreaded error 13 type mismacth here is what I have:
Code:
Dim AppPath As String
AppPath = CStr(Left(CurrentDb.Name, Len(CurrentDb.Name) - 12))
If Dir(AppPath & "ptotime.mdb) = "" Then
MsgBox "PTO 2002.mdb must be located in the same drive as last years PTOTIME.mdb" & Chr(13) & "Either move this database to that location or move that database to " & AppPath, vbCritical + vbOKOnly, Environ("Full")
Application.Quit
Exit Sub
End If
Code:
Dim lrsYearEnding As Recordset
Dim lsYearEndingSQL As String
Dim dbYearEnding As Database
Dim lrsCurrentDB As Recordset
Dim lsCurrentDBSQL As String
Set dbYearEnding = AppPath & "ptotime.mdb"
I do appologize for the length of this post. Any replies will be appreciated
Thanks
Scoty :
"Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),