dbTalk Databases Forums  

UniObjects

comp.databases.pick comp.databases.pick


Discuss UniObjects in the comp.databases.pick forum.



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

Default UniObjects - 10-16-2005 , 04:54 PM






Hello All,
I'm just starting out with using UniObjects to read a UniVerse database
through VB 6.0, and I've run into a problem. I can set up a plain, simple
record ID and read it from an open file into a UniDynArray object, as
follows:

F_ER.RecordId = EID
F_ER.Read
Set ER_Rec = F_ER.Record

In this case, EID may equal "000002311", for example.

The problem arises when I try to read a record with a key that has asterisks
(*) in it. It will work if I hard-code the key, but if I build it from
other variables, it will not work. Example:

EHKey = HistoryYear & "*" & EID & "*" & DNRNum & "*" &
TaxRateCode
F_EH.RecordId = EHKey
F_EH.Read
Set EH_Rec = F_EH.Record

This gives me an empty record in EH_Rec.

However, if I try:

EHKey = "1997*000002311*2*SK"
F_EH.RecordId = EHKey
F_EH.Read
Set EH_Rec = F_EH.Record

it works fine.

I have tried tried the following:

EHKey = HistoryYear & "*" & EID & "*" & DNRNum & "*" &
TaxRateCode
Check_EHKey = "1997*000002311*2*SK"
If EHKey = Check_EHKey Then
MsgBox "They Match!"
End If

and the system says that the "Built" key and the "Hard-coded" key match
eachother.

I've also tried replacing the "*" above with chr(42), to no avail.

So, does anyone have any suggestions as to why can't I build the key from
other variables and read it in? I'm sure it's something simple - like I
said, I'm just starting with this.

Thanks.

Dave





Reply With Quote
  #2  
Old   
Dave Mitchell
 
Posts: n/a

Default Re: UniObjects - 10-17-2005 , 01:07 AM






Actually, while trying other things, I finally got this to work. I stuck an
error check in after the read, as follows:

EHKey = HistoryYear & "*" & EID & "*" & DNRNum & "*" &
TaxRateCode
F_EH.RecordId = EHKey
F_EH.Read
If E_EH.Error = 30001 Then ' Record not found, which
legitimately could happen
MsgBox "Some error message"
Set EH_Rec = CreateObject("Uniobjects.UniDynArray")
Else
Set EH_Rec = F_EH.Record
End If

I don't know if the error checking is a syntactic requirement, or whether
there is just a time lag of a few milliseconds while reading that file so
that the setting of EH_Rec is completed before the Read is finished without
something between them (like this error check).

Maybe someone could elaborate.......

Dave



"Dave Mitchell" <mitch500 (AT) sympatico (DOT) ca> wrote

Quote:
Hello All,
I'm just starting out with using UniObjects to read a UniVerse database
through VB 6.0, and I've run into a problem. I can set up a plain, simple
record ID and read it from an open file into a UniDynArray object, as
follows:

F_ER.RecordId = EID
F_ER.Read
Set ER_Rec = F_ER.Record

In this case, EID may equal "000002311", for example.

The problem arises when I try to read a record with a key that has
asterisks (*) in it. It will work if I hard-code the key, but if I build
it from other variables, it will not work. Example:

EHKey = HistoryYear & "*" & EID & "*" & DNRNum & "*" &
TaxRateCode
F_EH.RecordId = EHKey
F_EH.Read
Set EH_Rec = F_EH.Record

This gives me an empty record in EH_Rec.

However, if I try:

EHKey = "1997*000002311*2*SK"
F_EH.RecordId = EHKey
F_EH.Read
Set EH_Rec = F_EH.Record

it works fine.

I have tried tried the following:

EHKey = HistoryYear & "*" & EID & "*" & DNRNum & "*" &
TaxRateCode
Check_EHKey = "1997*000002311*2*SK"
If EHKey = Check_EHKey Then
MsgBox "They Match!"
End If

and the system says that the "Built" key and the "Hard-coded" key match
eachother.

I've also tried replacing the "*" above with chr(42), to no avail.

So, does anyone have any suggestions as to why can't I build the key from
other variables and read it in? I'm sure it's something simple - like I
said, I'm just starting with this.

Thanks.

Dave







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.