Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Two questions: instr and table.column.value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Undrline - 01 Nov 2006 21:47 GMT
So, here's my simple code so far:

   Dim mylocation, stAppName As String
   
   mylocation = tbl_settings.Path.Value
   stAppName = mylocation & "\backup\backup.bat"
   Call Shell(stAppName, 1)

1) Apparently I'm not saying "tbl_settings.Path.Value" the right way (FYI,
the table only has one record)
2) I don't know the equivalent of InStr for VBA . . . but, I want to make
sure that the path was written correctly.  I don't want to end up with
\\path\\backup\backup.bat or \\pathbackup\backup.bat or
x:\path\\backup\backup.bat or x:\pathbackup\backup.bat

Thank you.
Van T. Dinh - 02 Nov 2006 00:17 GMT
1. Check Access VB Help on the DLookUp function to retrieve a Field value
from a Table.

2.  Check the last character of the retrieved value using Right() and if it
is "\", remove it from the retrieved value unsing Left() & Len().

All functions mentioned are well explained in Access VB Help.

Signature

HTH
Van T. Dinh
MVP (Access)

> So, here's my simple code so far:
>
[quoted text clipped - 12 lines]
>
> Thank you.
Undrline - 02 Nov 2006 00:50 GMT
DLookUp() wasn't so well explained, but I was able to find a better
explanation, once I had the function name.

Right() worked perfectly.

Thank you!

So, for your edification, here is the new code:

Private Sub Command24_Click()
     
   'Application.RunCommand acCmdBackup
   ' The above code, though it should work, does not.  This is a workaround:
     
   'CommandBars("Menu Bar"). _
   '   Controls("Tools"). _
   '   Controls("Database Utilities"). _
   '   Controls("Back Up Database..."). _
   '   accDoDefaultAction
   
   ' I split the database; now the backup code is not enough
   ' This will run the backup utility, based on the location of the db
   Dim mylocation, stAppName As String
   
   mylocation = DLookup("Path", "tbl_settings")
   
   If Right(mylocation, 1) = "\" Then
   stAppName = mylocation & "backup\backup.bat"
   Else
   stAppName = mylocation & "\backup\backup.bat"
   End If
   
   Call Shell(stAppName, 1)
   
       
End Sub

And, the backup utility is:

ECHO OFF

cls

echo .
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo Backup Utility
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo .
echo .
ECHO Copying Front End
copy "%~dp0..\CAT.mde" "%~dp0CAT.mde" /y
ECHO Copying Back End
copy "%~dp0..\CAT_BE.mdb" "%~dp0CAT_BE.mdb" /y
ECHO .
ECHO .
ECHO If it does not say "1 file(s) copied"
ECHO twice above, then the backup utility failed.
ECHO .
pause

> 1. Check Access VB Help on the DLookUp function to retrieve a Field value
> from a Table.
[quoted text clipped - 20 lines]
> >
> > Thank you.
Van T. Dinh - 02 Nov 2006 01:31 GMT
You're welcome ... Glad you worked it out  ...

I haven't used acCmdBackup but I think it only backs up the current
database, i.e. onlt the Front-End in your case ....

Signature

HTH
Van T. Dinh
MVP (Access)

> DLookUp() wasn't so well explained, but I was able to find a better
> explanation, once I had the function name.
[quoted text clipped - 55 lines]
> ECHO .
> pause
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.