|
-
Dec 29th, 2005, 02:45 PM
#1
Thread Starter
Lively Member
Howto change Database name and Recordsource at runtime?
hi
i want to change connection(database) and command1's RecordSource (Tables) of DataGrid??
-
Dec 29th, 2005, 02:59 PM
#2
Hyperactive Member
Re: Howto change Database name and Recordsource at runtime?
I'm not really sure what you are trying to do here. Can you elaborate maybe step by step what is happening and what you need to happen
-
Dec 29th, 2005, 03:09 PM
#3
Thread Starter
Lively Member
Re: Howto change Database name and Recordsource at runtime?
Private Sub Command4_Click()
Dim dbn As String
dbn = "C:\windows\desktop\sarfraz\p\data\"
DataEnvironment1.Connection1.ConnectionString = dbn & Form8.List1.ListIndex & ".mdb"
message 3705 object is open (etc...)
-
Dec 30th, 2005, 07:16 AM
#4
Re: Howto change Database name and Recordsource at runtime?
You can't rename a file (any file) while that file is open.
So, to do what you want, your program must first, close the database and remove all connections to it. Then, you can do a rename and reset the recordsource.
-
Dec 30th, 2005, 07:24 AM
#5
Frenzied Member
Re: Howto change Database name and Recordsource at runtime?
basically this is what hack was trying to say.
VB Code:
dataenvironment1.connection1.close
dataenvireonment1.connection1.connectionstring=newdb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|