Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Pervasive Active X Controls with VB

Pervasive Active X Controls with VB

Pervasive Active X Controls with VB

I have been using API to tap into Btrieve files. I am able to Insert, Update, Delete.  I now have to do the same thing only use Pervasive Active X Controls with Visual Basic. I am able to Read the information into a VAList1 listbox but I have no clue as to Insert information into the file.  I have searched the Internet and haven't found much help.  Pervasive.com showed a GetFirst (Read) sample but that's it.  Is there any website where I can view some sample coding?  Does anyone have some sample coding that I may view?  Any help is appreciated.  Thanks.

RE: Pervasive Active X Controls with VB

I don't have any specific code but basically you need to set the fieldvalues for each field in the table then issue the Insert (Vaccess.Insert) method.  

Certified Pervasive Developer
Certified Pervasive Technician

RE: Pervasive Active X Controls with VB

The Pervasive SDK has lots of information on the ActiveX controls.  While I use the API in some programs most use the ActiveX controls and they work very well.  You can save lots of time in development.  The info is at www.pervasive.com under the Developers section.


RE: Pervasive Active X Controls with VB

Thanks.  I am able to read the data except for the Date fields.  In the Pervasive Control Center when no date is entered it automatically enters '00000000' but the Pervasive Active X Controls does not recognize the fieldvalue as a number so I keep getting 'Error 0'.  If I manually delete the '00000000' then I can read the date field else I get the 'Error 0' error.  Is there a way around this error?  Any help is appreciated. Thanks.

RE: Pervasive Active X Controls with VB

You need to do a check for isdate(vaccess.fieldvalue("datename"))

If it is not a date then you have to code around it.

I ran into the same problem so I always do a isdate check.



RE: Pervasive Active X Controls with VB

Thanks Gil.  Now I have another problem.  The date fields that must be entered are of the format yyyymmdd.  That's how they are stored in the Pervasive Control centre.  All the GET commands work fine.  When I use the GetFirst command and then clear the form for an Insert the VAccess1.FieldValue("AnyDateField") retains the information from the previous Get function.  I can't seem to save the DateFields as null or "00000000" even though the textfield is blank. When I used API I was able to save the DateFields as all zeros but not with SDK. I've tried VAccess1.FieldValue("AnyDateField") = "00000000" and VAccess1.FieldValue("AnyDateField") = "" none of which works.  Any suggestions? Thanks in advance.


RE: Pervasive Active X Controls with VB

Are the fields actually the Pervasive Btrieve Date type?  If so then I guess your regional settings must be set to display the date in the yyyymmdd format.  

One thing to remember with the activex controls is when you do a vaccess1.clear then also do a vaccess1.refresh.  Even doing this if you were to enter data then Update the record instead of Insert you would be updating the first record given you had done a .getfirst before doing the above.  I never liked this about the activex controls but you just have to make sure you understand what they are doing.

As far as the date I usually leave it blank.  I double checked it and when I leave it blank or do 00/00/0000 it places binary zero's into the 4 bytes of the data file.


RE: Pervasive Active X Controls with VB

Thanks for the tip Gil.  It helped immensely.

RE: Pervasive Active X Controls with VB

Thanks for the info now I have another problem that I can't seem to get around.

This particular file has a criteria. The SEQUENCE field has to be equal to "0".  I set up a Do Loop but somehow when I get to the end of the file the SDK doesn't recognize that it's reached the end and it keeps looping the same last record over and over.  If my last record's SEQUENCE was "1" then it keeps checking for "1" and never exits the Do Loop.  Does anyone know if there's a way to signal the EOF with SDK?

Private Sub cmdGetNext_Click()
        If Me.VAccess1.FieldValue("SEQUENCE") = 0 Then
            Call BOMTopLevelData
            Found = True
            Exit Sub
            Me.VAccess1.GetNext   'this is where it keeps looping
            Found = False
        End If
    Loop Until Found = True
End Sub

Thanks in advance.  Any help is appreciated.

RE: Pervasive Active X Controls with VB

You need to check for me.vaccess1.status = 9 then it is the end of the file.


RE: Pervasive Active X Controls with VB

Thanks for the help Gil.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close