Set Database Name property using no path 
Author Message
 Set Database Name property using no path

if that is the exact syntax for the SQL statement looks like it should be

LoggedUser = MyInputfield.Text  'Assuming that this is a textfield input.

data1.RecordSource = "Select STORE.Store_Code From STORE Where Store.User =
" & LoggedUser & ";"

Hope this helps
David Hassell
BonWorth, Inc
www.bonworth.com

Quote:

>I am using a number of standard data controls to bind DBCombo boxes to
>fields and have them filled with the list of data. This all works fine
>except that I have browsed to the database with the data control for
>the DatabaseName property and again I want to get around having the
>database in the specified path.
>How can I set the DatabaseName property using no path?
>How can I use SQL to select only required data when the RecordSource
>has been bound to tables for these DBCombo boxes? - I have tried
>putting the SQL in the RecordSource property but this falls over with
>required parameter or something. So to get these to work I have bound
>the controls to the tables and put the SQL in DBCombo_Click as below:-

>Private Sub ADD1_Store_Click(Area As Integer)
>Data1.RecordSource = "SELECT STORE.Store_Code FROM STORE WHERE
>(STORE.User)=LoggedUser))"
>'Data1.Refresh
>End Sub

>But although the records come back from the table (all records), the
>SQL does not refine the search???

>Sent via Deja.com http://www.*-*-*.com/
>Share what you know. Learn what you don't.



Fri, 28 Dec 2001 03:00:00 GMT  
 Set Database Name property using no path
I am using a number of standard data controls to bind DBCombo boxes to
fields and have them filled with the list of data. This all works fine
except that I have browsed to the database with the data control for
the DatabaseName property and again I want to get around having the
database in the specified path.
How can I set the DatabaseName property using no path?
How can I use SQL to select only required data when the RecordSource
has been bound to tables for these DBCombo boxes? - I have tried
putting the SQL in the RecordSource property but this falls over with
required parameter or something. So to get these to work I have bound
the controls to the tables and put the SQL in DBCombo_Click as below:-

Private Sub ADD1_Store_Click(Area As Integer)
Data1.RecordSource = "SELECT STORE.Store_Code FROM STORE WHERE
(STORE.User)=LoggedUser))"
'Data1.Refresh
End Sub

But although the records come back from the table (all records), the
SQL does not refine the search???

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sat, 29 Dec 2001 03:00:00 GMT  
 Set Database Name property using no path

Quote:
> I am using a number of standard data controls to bind DBCombo boxes to
> fields and have them filled with the list of data. This all works fine
> except that I have browsed to the database with the data control for
> the DatabaseName property and again I want to get around having the
> database in the specified path.
> How can I set the DatabaseName property using no path?

I assume you want the app to work regardless of where the app/database is
installed.  You can set the DatabaseName property of each data control at
runtime, once your app knows where the database is.

The bottom line is that you must either assume the database is in a path
relative to App.path and set DatabaseName from a "constructed" path built
from App.Path + some subdirectory, or you will need to have the user define
where the DB is so that the program can store and retrieve that information
at startup and then set all the data controls' DatabaseName properties at
runtime.

In one application we designed, we always place the DB in a "Data" directory
under the application's EXE directory during installation.  The program
starts by assuming it's there (App.Path & "\Data\mydb.mdb").  If it's not
there, it checks for a registry entry that will contain the DB location.  If
that doesn't exist, or the DB doesn't exist in the location specified in the
registry, then it prompts the user using a Browse for Folder style dialog
and saves the response in the registry for the next boot.

We also created a generic sub that is called during Form_Load to set all the
data controls on a single form:

Public Sub SetFormDBPaths(Frm As Form)
    Dim I As Integer

    For I = 0 To Frm.Controls.Count - 1
        If TypeOf Frm.Controls(I) Is Data Then
            Frm.Controls(I).DatabaseName = gDBPath + DATABASE_FILENAME
        End If
    Next I
End Sub

So, in every Form_Load, we have the same simple call:     Call
SetFormDBPaths(Me)

This is just one way of doing it, but it should give you some ideas.

--
Vinnie Murdico
Software with Brains, Inc.
http://www.softwarewithbrains.com



Sun, 30 Dec 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Set Database name using no path

2. Set the DatabaseName Property using no path

3. Setting FileListBox.Path and Naming New Program Items

4. Retrieving Full Database Path Name

5. Current database path name

6. Path names in a database problem

7. Passing Database name and path

8. Picking up path name of Access Database

9. Setting Path to Access Database

10. Setting Path to Access Database

11. Setting path to database from text file ??

12. How to set path for database (.mdb) file ???

 

 
Powered by phpBB® Forum Software