me again

dreamdelerium

Registered User.
Local time
Today, 09:37
Joined
Aug 24, 2007
Messages
88
ok, let me clarify what im asking, i know i was a bit vague so I thought it would be better to start a new thread. i have a form that entering a recordset into table A. before it can enter this
data i need to search all recordsets of another table (table B), find one field from that recordset and return it to the original form, as a string, so that i
can concat it to enter into record set of table A. I will then use this string to create another query to do something else. another thing. i need to
search a table to see what value exists in it. i then need to return that value to the form that using it and do different tasks depending on what value is
there. also, im not sure if this matters but everything is client sided. i did find something that "works" i have a module that seeks records using ADODB but it will only
connect to another database. i cant do it in the database currently open. when i do i get an errors saying " the database has been placed in a state by user "admin"
on maching 'goodhope' that prevents it from being opened or locked" the code is below. also, if theres a way to do this in the form itself and not a module, that would be great. FYI this will be a client sided program< not on a server


Option Compare Database
Option Explicit

Function SeekRecord()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset

Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset

'Set the connection properties and open the connection.
With conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "C:\National S&CD Client Tracker\blankdb.mdb"
.Open
End With

With rst
'Select the index used in the recordset.
.Index = "PrimaryKey"

'Set the location of the cursor service.
.CursorLocation = adUseServer

'Open the recordset.
.Open "OrphanOrNs", conn, adOpenKeyset, _
adLockOptimistic, adCmdTableDirect

'Find the customer order where OrderID = 10255 and ProductID = 16.
.Seek Array(2222), adSeekFirstEQ

'If a match is found, print the quantity of the customer order.
If Not rst.EOF Then
Dim test
test = MsgBox("f")

Else: test = MsgBox("Nf")
End If
End With
End Function
 
there. also, im not sure if this matters but everything is client sided. i did find something that "works" i have a module that seeks records using ADODB but it will only
connect to another database. i cant do it in the database currently open. when i do i get an errors saying " the database has been placed in a state by user "admin"
I'll deal with this problem and maybe that will help you figure out the rest.

Instead of using:

Code:
'Set the connection properties and open the connection.
With conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "C:\National S&CD Client Tracker\blankdb.mdb"
.Open
End With

Just use this:
Code:
'Set the connection properties and open the connection.
conn = CurrentProject.Connection

fewer lines of code and it should work without telling you that you can't access it.
 
thanks for your help :)
 

Users who are viewing this thread

Back
Top Bottom