473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Why does HyperlinkPart return inconsistent values?

This code is supposed to delete documents from local storage that are
associated with a particular record. That is, if a hyperlink to the
document exists in tblDocuments, then delete that document. But if the
document is associated with other records in the database, do not delete it.
Should be simple enough - just count the number of times the document
appears in tblDocuments and delete on the condition that it appears only
once.

lngEid = the record in question
strSql = "SELECT HyperlinkPart([Document],0) As HlkDoc FROM tblDocuments
WHERE Entity_ID = " & lngEid
Set rst = CurrentDb.OpenRecordset(strSql)
'loop through documents associated with lngEid, check each one to make sure
it's not linked to other records
Do Until rst.EOF
'this DCount statement always returns 0 - even if the hyperlink appears
multiple times in the table
intDocCt = DCount("Doc_ID", "tblDocuments", "HyperlinkPart([Document],0)
= " & rst!HlkDoc)
If intDocCt = 1 Then
strDdoc = DLookup("DocDir", "tblPrefs") & "\" & rst!HlkDoc
Set objFile = CreateObject("Scripting.FileSystemObject")
objFile.DeleteFile strDdoc
End If
rst.MoveNext
Loop

I've tried debug.print to check rst!HlkDoc - looks fine. Why does that
DCount always return 0? Are there hidden characters in HyperlinkPart? Am I
missing something, or should I maybe go about this another way?

Nov 12 '05 #1
1 2795
> I've tried debug.print to check rst!HlkDoc - looks fine. Why does that
DCount always return 0? Are there hidden characters in HyperlinkPart? Am I missing something, or should I maybe go about this another way?


good 'ol Chr(34) did the trick...

strSql = "SELECT HyperlinkPart([Document],0) As HlkDoc FROM tblDocuments
WHERE Entity_ID = " & lngEid
Set rst = CurrentDb.OpenRecordset(strSql)
Do Until rst.EOF
If DCount("Doc_ID", "tblDocuments", "HyperlinkPart([Document],0) = " &
Chr(34) & rst!HlkDoc & Chr(34)) = 1 Then
strDdoc = DLookup("DocDir", "tblPrefs") & "\" & rst!HlkDoc
Set objFile = CreateObject("Scripting.FileSystemObject")
objFile.DeleteFile strDdoc
End If
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: The Pistoleer | last post by:
I have an inconsistent problem with some Internet pages when using Netscape (7.1) that I cannot reproduce with IE nor locally. Below is an example link. There are several tables on the pages. ...
1
by: deko | last post by:
This code is supposed to delete documents from local storage that are associated with a particular record. That is, if a hyperlink to the document exists in tblDocuments, then delete that...
2
by: Kjetil Bjerknes | last post by:
I'm currently creating some user controls in C#, and I've come across the interface IServiceProvider. This interface must be one of the worst examples of bad design I've ever seen. It contains one...
2
by: Dot net work | last post by:
Hello, My simple code is here: Public Class MyDictionary Inherits System.Collections.DictionaryBase Private Class MyElement Public Overloads Overrides Function Equals(ByVal obj As Object)...
13
by: MLH | last post by:
Invalid qualifier error displays at compile time on this A97 example from Permissions Property HELP. What's wrong with the strContainerName assignment line? (6th line) Sub...
1
by: bachyen | last post by:
I have the following code, but it is error when I build it. Can you help me? Can you tell me more about 'Inconsistent accessibility: return type', 'Inconsistent accessibility: parameter type'. ...
3
by: Rahul Babbar | last post by:
Hi All, When could be the possible reasons that could make a database inconsistent? I was told by somebody that it could become inconsistent if you " force all the applications to a close on...
0
by: johnthawk | last post by:
In the below code setting cell to inconsistent sets entire column inconsistent (renderer).However, I need a third state off | on | inconsistent . How can I change one path->cell? Any help...
11
by: tracy | last post by:
Hi, I really need help. I run this script and error message appeal as below: drop trigger log_errors_trig; drop trigger log_errors_trig ERROR at line 1: ORA04080: trigger 'LOG_ERRORS-TRIG'...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.