Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exists function

Status
Not open for further replies.

heefan1

Programmer
Joined
Nov 3, 2008
Messages
5
Location
SG
Hi guys,

what does Exists do?

Just from API, I am still very clear about this function.

E.g.
temp = PMCONT1detail2.Exists

Pls give me some hints. Tks
 
Pls see the following code,

PMCONT1header.Fetch
Debug.print PMCONT1headerFields("CONTRACT")
temp = PMCONT1header.Exists
PMCONT1header.Fetch
Debug.print PMCONT1headerFields("CONTRACT")

Suppose the current record is "C00001"
so the result will be:
C00001
C00001

However, when I comment temp = PMCONT1header.Exists
The result will be:
C00001
C00002

What had happened when I called Exists?

Confused....
 
actually, .Exists not only check current record exists I think.

because you see,

.Fetch 'get current record
.Fetch 'get next record

however,
.Fetch 'get current record
.Exists 'check current record
.Fetch 'get current record again, not next record.

so,am I right?
 
Whether you're right or wrong, you're wasting your time. .Exists doesn't add anything to your program.
 
Property Exists As Boolean
read-only
Member of AccpacCOMAPI.AccpacView
Reports whether the current logical record exists in the database.

What you read into that is up to you.
 
I say it's extra processing that slows things down. You're already doing a .Read or a .Fetch, which gives you the same info.
 
You can use it to determine if you need to do a .insert or a .update.
 
I guess, but I've been coding like this for years:

MyView.Browse "SomeThing", True
If MyView.Fetch
Somestuff
MyView.Update
Else
OtherStuff
MyView.Insert
End If
 
Thanks all.

I think that's enough for me.
Thanks very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top