Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection to Another Database

Status
Not open for further replies.

DougAtAvalon

Programmer
Jan 29, 2001
99
0
0
US
I am trying to write information to another db without linking tables

I get a pop up to choose the db type. I think I can use the "connection" argument for this but I can't figure it out. It's the OpenDatabase line . . .

*****************
Private Sub BSecurityOnOff_Click()
On Error Resume Next
Dim strSQL As String
Dim ws As Workspace, db As Database, rs As Object

Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(vNetworkPath, , False)

strSQL = "SELECT DefaultSettings.*, DefaultSettings.DefaultID FROM DefaultSettings WHERE DefaultID = 'SecurityOn'"

Set rs = db.OpenRecordset(strSQL)
rs.Edit
If rs![DefaultValue] = 0 Then vRecordset!DefaultID = -1
If rs![DefaultValue] = -1 Then vRecordset!DefaultID = 0

rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
ws.Close
Set ws = Nothing

SecurityRedefined
End Sub

***********

-Doug
 
Just doing that!!
Add
IN 'c:\Somewhere\somefile.thing'

after the FROM Peter Meachem
peter@accuflight.com
 
Is the "In" statement in place of the "OpenDatabase" statement?

My problem starts with the "OpenDatabase" statement

I get a pop up to choose the db type. It's the OpenDatabase line that is the problem first.

If I just put the "In" statement I still have to declare what database to open.

-Doug

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top