dbTalk Databases Forums  

ActiveX Joins w/o Form

comp.databases.btrieve comp.databases.btrieve


Discuss ActiveX Joins w/o Form in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
henry
 
Posts: n/a

Default ActiveX Joins w/o Form - 10-08-2004 , 08:05 PM






As a follow up to an earlier post, I am providing the actual vb form
code that I am attempting to use. As I stated earlier, the second
data control doesn't advance properly using the join unless you use
the control plopped onto a form. Creating the control in code seems
to not work.
here is the code for the form...I am using the Demodata sample
database

When I click on the command1 button the db1 advances, however db2
doesn't.
Everything works well if I use the actual controls on a form however.

VERSION 5.00
Begin VB.Form frmTest3
Caption = "Form1"
ClientHeight = 4965
ClientLeft = 60
ClientTop = 345
ClientWidth = 7365
LinkTopic = "Form1"
ScaleHeight = 4965
ScaleWidth = 7365
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text3
Height = 375
Left = 3840
TabIndex = 4
Text = "Text3"
Top = 1680
Width = 2775
End
Begin VB.TextBox Text2
Height = 375
Left = 3840
TabIndex = 3
Text = "Text2"
Top = 1080
Width = 2775
End
Begin VB.TextBox Text1
Height = 375
Left = 840
TabIndex = 2
Text = "Text1"
Top = 1080
Width = 2295
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1800
TabIndex = 0
Top = 2040
Width = 1095
End
Begin VB.Label Label1
Caption = "Label1"
Height = 255
Left = 1680
TabIndex = 1
Top = 600
Width = 1815
End
End
Attribute VB_Name = "frmTest3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db1 As VAccess
Dim db2 As VAccess
Private Sub Command1_Click()
db1.GetNext
Text1.Text = db1.FieldValue(0)
Text2.Text = db2.FieldValue(0)
Text3.Text = db2.FieldValue(4)
Label1.Caption = db1.RowPosition & " " & db2.RowPosition
End Sub

Private Sub Form_Load()
Set db1 = New VAccess
Set db2 = New VAccess
With db1
.DdfPath = "C:\PVSW\Demodata"
.TableName = "Enrolls"
.Location = "Enrolls.mkd"
.IndexNumber = 0
.IncludeCurrent = True
.Open
.Init
.GetFirst
End With
With db2
.DdfPath = "C:\PVSW\Demodata"
.TableName = "Student"
.Location = "Student.mkd"
.AutoMode = True
.IndexNumber = 0
.Join = "db1:Student_ID"
.IncludeCurrent = True
.Open
.Init
.GetFirst
End With
End Sub

Reply With Quote
  #2  
Old   
dbSw Solutions, Inc.
 
Posts: n/a

Default Re: ActiveX Joins w/o Form - 10-10-2004 , 12:48 PM






You can create instances in code:

Dim oVA As Object
Dim iStat As Integer
Set oVA = CreateObject("VACCESS.VAccessCtrl.7")
With oVA
..AutoOpen = False
..RefreshLocations = True
..DdfPath = "D:\Pvsw\Demodata"
..Location = "D:\Pvsw\Demodata\person.mkd"
..TableName = "Person"
iStat = .Open
End With



Reply With Quote
  #3  
Old   
henry
 
Posts: n/a

Default Re: ActiveX Joins w/o Form - 10-10-2004 , 06:06 PM



"dbSw Solutions, Inc." <Don.Brady (AT) cox (DOT) net> wrote

Quote:
You can create instances in code:

Dim oVA As Object
Dim iStat As Integer
Set oVA = CreateObject("VACCESS.VAccessCtrl.7")
With oVA
.AutoOpen = False
.RefreshLocations = True
.DdfPath = "D:\Pvsw\Demodata"
.Location = "D:\Pvsw\Demodata\person.mkd"
.TableName = "Person"
iStat = .Open
End With
Thanks for your reply....I know how to create in code, this is the
same as what you posted except this is early binding of the object.
Read the post, my issue is not that general...thx

Early Binding:
Dim Student As VAccessLib.VAccess
Set Enrolls = New VAccessLib.VAccess


Reply With Quote
  #4  
Old   
dbSw Solutions, Inc.
 
Posts: n/a

Default Re: ActiveX Joins w/o Form - 10-10-2004 , 07:20 PM



Don't have .Net and can't early bind Pvsw ActiveX in VB5 or VB6 when
creating objects in code. You are not going to be able to use the .Join via
code generated controls (at least I have never got it to work). You could
do the following and get same result:

Dim oVA1 As Object
Dim oVA2 As Object
Dim iStat As Integer

Set oVA1 = CreateObject("VACCESS.VAccessCtrl.7")
Set oVA2 = CreateObject("VACCESS.VAccessCtrl.7")

With oVA1
.AutoOpen = False
.RefreshLocations = True
.DdfPath = "D:\Pvsw\Demodata"
.Location = "D:\Pvsw\Demodata\Student.mkd"
.TableName = "Student"
.IndexNumber = 0
iStat = .Open
End With

With oVA2
.AutoOpen = False
.RefreshLocations = True
.DdfPath = "D:\Pvsw\Demodata"
.Location = "D:\Pvsw\Demodata\Enrolls.mkd"
.TableName = "Enrolls"
.IndexNumber = 0
iStat = .Open
End With

With oVA1
iStat = .GetFirst
Do While (iStat = 0)
Debug.Print "ID = " & .FieldValue("ID")
oVA2.GetFirst
oVA2.FieldValue("Student_ID") = .FieldValue("ID")
oVA2.FieldValue("Class_ID") = -32768
iStat = oVA2.GetGreaterOrEqual
Do
iStat = (oVA2.FieldValue("Student_ID") = .FieldValue("ID"))
If (iStat = -1) Then
Debug.Print "Class_ID = " & oVA2.FieldValue("Class_ID")
iStat = oVA2.GetNext
End If
Loop While (iStat = -1)
iStat = .GetNext
Loop
End With

oVA1.Close
Set oVA1 = Nothing
oVA2.Close
Set oVA2 = Nothing



Reply With Quote
  #5  
Old   
henry
 
Posts: n/a

Default Re: ActiveX Joins w/o Form - 10-11-2004 , 10:19 AM



"dbSw Solutions, Inc." <Don.Brady (AT) cox (DOT) net> wrote

Quote:
Don't have .Net and can't early bind Pvsw ActiveX in VB5 or VB6 when
creating objects in code. You are not going to be able to use the .Join via
code generated controls (at least I have never got it to work). You could
do the following and get same result:

Thanks mucho for the code, it will help me to accomplish what I am
attempting to do. I suppose I'll forget about the joins and just
handle it in code. FYI: You really can early bind in VB6, (not using
dot net yet) the pervasive activeX stuff.
In fact you can apparantly use "VACcess" or "VAccessLib.VAccess" or
you can use the CreateObject("VACCESS.VAccessCtrl.7") if you want to,
all seem to "work" the same except of course the early binding is
easier to do when coding intellisense etc. Set the references in the
project, point to the OCX works for me.

thx

-Henry


Reply With Quote
  #6  
Old   
dbSw Solutions, Inc.
 
Posts: n/a

Default Re: ActiveX Joins w/o Form - 10-11-2004 , 01:10 PM



Thanks for the reference tip. Compiled little example using your early
binding technique and worked like a champ. I remember trying this when it
was a Smithware control but only worked in IDE (at least that's how I
remember). Still use Pvsw flavor of control and like an old dog, never
bothered testing code via early binding. Time to update some class modules
- Don



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.