Charles,
Thank you for pointing me in the right direction. After some testing,
the following seems to work (although I have not tried to access
records yet):
DIM dlg AS NEW OpenDialog
CustomerDB.DatabaseFile = dlg.ShowModal() // have user
find DB via dialog
IF (CustomerDB.DatabaseFile <> NIL) THEN // if user
did not cancel the dialog, then
IF (CustomerDB.Connect = FALSE) THEN // connect
to customer database
DisplayCustomerDBError //
display error if connection failed
MsgBox "Connection to database failed. Program will cancel."
Quit
END IF
ELSE
MsgBox "Database not selected. Program will cancel."
Quit // user
cancelled OpenDialog
END IF
The dlg.Filter = ".rbd" statement caused the rbd files to be dimmed.
Not sure what was going on there, so I deleted this filter.
TJH
On May 27, 2006, at 10:44 AM, Charles Yeomans wrote:
First, you should use an OpenDialog object. It can be customized a
little.
Second, it would be helpful if you could more precisely say how
your code "does not work". Does it not compile? If not, the
compiler will provide an error message. If it compiles, then
presumably something bad happens when the program is running.
Here is a bit of sample code that may work.
dim dlg as new OpenDialog
dlg.Filter = ".rbd"
If dlg.ShowModal <> nil then
CustomerDB.DatabaseFile = dlg.Result
//proceed with db open
Else
//user cancelled
End if
Charles Yeomans
On May 27, 2006, at 1:25 PM, TJ Hanson wrote:
I have a database (CustomerDB.rbd) that was created by Program 1.
From Program 2, I want to access this database. So I need to have
the user locate it, then connect to it.
My question is, how do I do this?
---------------------------------------------------------------------
-------------------------------------------
CustomerDB.DatabaseFile = GetOpenFolderItem("rbd") //
user locates the Customer DB file.
IF (CustomerDB.Connect = FALSE)
THEN // connect to customer DB.
DisplayCustomerDBError
Quit
END IF
---------------------------------------------------------------------
-------------------------------------------
The above code does not work since GetOpenFolderItem is probably
the wrong method, or I am using it incorrectly, since it returns a
folderitem.
What's the solution? Thanks for the help,
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>