If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
app.path i dunno whats wrong HELP newbie here?
AM USING THIS for
now---------------------------------------------------------------------------------------- Public Sub OpenDBConnection() Set conn = New ADODB.Connection Set rec = New ADODB.Recordset strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\balik sa dati\data\MFMS.mdb;Persist Security Info=False" conn.CursorLocation = adUseClient conn.Open strconek End Sub ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- ICANT USE THIS Public Sub OpenDBConnection() Set conn = New ADODB.Connection Set rec = New ADODB.Recordset strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & app.path & "\data\MFMS.mdb;Persist Security Info=False" conn.CursorLocation = adUseClient conn.Open strconek End Sub ----------------------------------------------------------------------------------------- the error is: |
#2
|
|||
|
|||
app.path i dunno whats wrong HELP newbie here?
If you're trying to use this from within Access, there is no App object in
Access, so App.Path will (naturally) fail. Assuming you're using Access 2000 or newer, use CurrentApplication.Path instead. BTW, note that both App.Path and CurrentApplication.Path have an annoying little "feature". If the file is in the root of a drive, what's returned will have a terminating slash: E:\, not simply E:. That means that something like strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\MFMS.mdb;Persist Security Info=False" or strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentApplication.Path & "\data\MFMS.mdb;Persist Security Info=False" will fail, as you'll end up with two slashes in a row. To get around this, try: Dim strPath As String strPath = CurrentApplication.Path If Right$(strPath, 1) "\" Then strPath = strPath & "\" End If strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath & "\data\MFMS.mdb;Persist Security Info=False" -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) wrote in message ups.com... AM USING THIS for now---------------------------------------------------------------------------------------- Public Sub OpenDBConnection() Set conn = New ADODB.Connection Set rec = New ADODB.Recordset strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\balik sa dati\data\MFMS.mdb;Persist Security Info=False" conn.CursorLocation = adUseClient conn.Open strconek End Sub ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- ICANT USE THIS Public Sub OpenDBConnection() Set conn = New ADODB.Connection Set rec = New ADODB.Recordset strconek = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & app.path & "\data\MFMS.mdb;Persist Security Info=False" conn.CursorLocation = adUseClient conn.Open strconek End Sub ----------------------------------------------------------------------------------------- the error is: |
#3
|
|||
|
|||
app.path i dunno whats wrong HELP newbie here?
"Douglas J. Steele" wrote in
message Assuming you're using Access 2000 or newer, use CurrentApplication.Path instead. CurrentProject.Path, I think Doug means. -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#4
|
|||
|
|||
app.path i dunno whats wrong HELP newbie here?
"Dirk Goldgar" wrote in message
... "Douglas J. Steele" wrote in message Assuming you're using Access 2000 or newer, use CurrentApplication.Path instead. CurrentProject.Path, I think Doug means. Thanks, Dirk. I've only got Access 97 installed on this machine, so I was going from memory. For the record, in Access 97 or earlier, you'd use Left$(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir$(CurrentDb.Name))) -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) |
Thread Tools | |
Display Modes | |
|
|