JasonLJames
03-08-2003, 07:31 PM
Dear all,
I have successfully imported my database into my PPC and attached to it. I can navigate through the records and display their contents on the form. I am however having some difficulty in finding a particular record based on a text entry from the user. The code below demonstrates what I am trying to do:
Private Sub Command5_Click()
' Find specified record using text1.text
Dim cSQL As String
cSQL = "cTitle like " & Chr(39) & Text1.Text & Chr(39)
myRS.Find cSQL
DisplayRecord
End Sub
The database and recordset are defined and attached to as:
Public myDB As ADOCE.Connection
Public myRS As ADOCE.Recordset
and
Set myDB = CreateObject("ADOCE.Connection.3.0")
myDB.ConnectionString = "data source = \My Documents\cd.cdb"
myDB.Open
cSQL = "SELECT ID, cTitle FROM tblCD ORDER BY cTITLE;"
Set myRS = CreateObject("ADOCE.RecordSet.3.0")
myRS.Open cSQL, myDB, adOpenDynamic, adLockOptimistic
Everything works fine until I attempt to execute the find. I then get an application error An error was encounteered while running this program: Unspecified Error
I am running the code on my PPC, not the emulator.
Any help or thoughts would be greatly appreciated.
Many thanks,
Jason.
I have successfully imported my database into my PPC and attached to it. I can navigate through the records and display their contents on the form. I am however having some difficulty in finding a particular record based on a text entry from the user. The code below demonstrates what I am trying to do:
Private Sub Command5_Click()
' Find specified record using text1.text
Dim cSQL As String
cSQL = "cTitle like " & Chr(39) & Text1.Text & Chr(39)
myRS.Find cSQL
DisplayRecord
End Sub
The database and recordset are defined and attached to as:
Public myDB As ADOCE.Connection
Public myRS As ADOCE.Recordset
and
Set myDB = CreateObject("ADOCE.Connection.3.0")
myDB.ConnectionString = "data source = \My Documents\cd.cdb"
myDB.Open
cSQL = "SELECT ID, cTitle FROM tblCD ORDER BY cTITLE;"
Set myRS = CreateObject("ADOCE.RecordSet.3.0")
myRS.Open cSQL, myDB, adOpenDynamic, adLockOptimistic
Everything works fine until I attempt to execute the find. I then get an application error An error was encounteered while running this program: Unspecified Error
I am running the code on my PPC, not the emulator.
Any help or thoughts would be greatly appreciated.
Many thanks,
Jason.