C/FRONT Problems

HI, I am trying to use CFRONT to test the different things that it can do. However I am having trouble using the “FindRec” command. This is the error that I get when I execute my code: Run-time error ‘12000’: C/FRONT Fatal Error: Invalid handle. This is the line of code that causes the error: If CF.FindRec(UserTable, UserRecord, “-”) Then Below is the code to my function which is just going to put all the users in the database into a list box to view them. Dim UserTable As Long Dim UserRecord As Long If CF.OpenTable(UserTable, 2000000002) Then If CF.FindRec(UserTable, UserRecord, “-”) Then Do ListBox1.AddItem UserRecord Loop Until Not CF.FindRec(UserTable, UserRecord, “>”) Else MsgBox (“There are no Users setup in the database.”) End If Else MsgBox (“Table was not opened sucessfully.”) End If My connection to the database is not listed here, but my connection to my database is valid and I verified the active connection. The weird thing is I can use the command “UserCount” to count number of users in the database but can’t do a find on the User table. Any ideas on what could be wrong? Bobby

AllocRec is missing:

 
If CF.OpenTable(UserTable, 2000000002) Then
UserRecord = CF.AllocRec(UserTable)
If CF.FindRec(UserTable, UserRecord, "-") Then

Well that was easy. I had tried that command but didn’t use the return value (I used “Call” to ignore the return value). Anyways thanks for the fast response. Bobby

Hello Folks, Could anyone please hlep me. I try in VB following code: Set CF = CreateObject(“cfront.cfrontctrl.1”) Call CF.LoadLicenseFile(“c:\demo.flf”) Call CF.ConnectServer(xxx, TCP) but i get every time, the Error that i must ask my admin for access to the database. FYI: We habe in our licence the C/Front licences. How do i do gibe the connect the USERID and Password ? THANKS ------------------ Best regards Alejandro Schubert CYCOS AG System Engineer www.Cycos.com www.Dolphinct.de EMail: Alejandro.Schubert@Cycos.com

Check my sample code:


Set CF = CreateObject("cfront.cfrontctrl.1")
Call CF.ConnectServer("ip or name", "tcp")
If CF.Login("user ID", "psw") Then
   Call CF.OpenCompany("company name")
  ....

In registred cfront.ocx folder copy all necessary files, including your license file. LoadLicenseFile - is used only then you need use another license file (not installed in ocx folder). Make sure that user have CF and tables access rights.

i used it so, but it doesn’t work: my code Set cf = CreateObject(“cfront.cfrontctrl.1”) Call cf.LoadLicenseFile(“c:\fin.flf”) Call cf.ConnectServer(“yyy.yy.y.yyy”, “tcp”) Call cf.OpenDatabase(“e:\euro\xxx.fdb”, 8000, False) If cf.Login(“Syyy”, “xxx”) Then Call cf.OpenCompany(“company name”) But it’s doen’t work. The user is Super Admin, and the licenc have the CSIDE Add on. Every time i get the error is have no permission? Must i choose a company first ? ------------------ Best regards Alejandro Schubert CYCOS AG System Engineer www.Cycos.com www.Dolphinct.de EMail: Alejandro.Schubert@Cycos.com

quote:


Originally posted by Alex: Set cf = CreateObject(“cfront.cfrontctrl.1”) Call cf.LoadLicenseFile(“c:\fin.flf”)


You don’t need LoadLicenseFile, copy it in ocx folder.

quote:


Call cf.ConnectServer(“yyy.yy.y.yyy”, “tcp”) Call cf.OpenDatabase(“e:\euro\xxx.fdb”, 8000, False)


Use or connect or open database, but not both !!! If it doen’t help try use SetNavisionPath by pointing to ocx dir.

MERCI !!! It works. SetNavisionPath was the magic entry in my code, … Many Thanks ------------------ Best regards Alejandro Schubert CYCOS AG System Engineer www.Cycos.com www.Dolphinct.de EMail: Alejandro.Schubert@Cycos.com

One question … I have following code: If cf.FindRec(UserTable, UserRecord, “-”) Then Do List1.AddItem UserTable MsgBox cf.FieldCount(UserTable) Loop Until Not cf.FindRec(UserTable, UserRecord, “”) How can i put field values in the list box item ? ------------------ Best regards Alejandro Schubert CYCOS AG System Engineer www.Cycos.com www.Dolphinct.de EMail: Alejandro.Schubert@Cycos.com


If cf.FindRec(UserTable, UserRecord, "-") Then
  Do
    List1.AddItem(GetFieldData(UserTable,UserRecord, FieldNo))
  Loop Until cf.NextRec(UserTable, UserRecord, 1)=0

RTFM !!!

I do RTFM … Sorry … But many thanks anyway. By the way, is it possible to put the found datas of the record in a flexGrid ? (No way to find somethink about this in the manuel ;.)) ------------------ Best regards Alejandro Schubert CYCOS AG System Engineer www.Cycos.com www.Dolphinct.de EMail: Alejandro.Schubert@Cycos.com Edited by - Alex on 2001 Aug 30 12:08:01