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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox True if Condition Met not working 3

Status
Not open for further replies.

RobotMush

Technical User
Aug 18, 2004
197
US
In trying to debug why I am unable to get my checkbox to register as true when the condition is met I created the following program

Private Sub FileType_AfterUpdate()
If IsNull([FileType]) Then
MsgBox "File Type Is Null"
Else
MsgBox "File Type Is " & FileType
End If
End Sub

This is supposed to check the file type field to see if it is null and display one or the other statements in the message box. However, nothing happens when I enter data and the FileType automatically generates the corresponding extension of the hyperlink I am entering.

Thank you for your help

RobotMush (Techincal User) Self Taught
 
That is correct.
I put the program you gave me as an AfterUpdate Event in the properties of my Hyperlinked Field. The FileType file is an unbound text box. The sub form OnCurrent event has the
"Private Sub Form_Current()
Call HypLnk_AfterUpdate
End Sub"
Program.

At this point I am not sure what is supposed to be doing on each line of the program. I have printed them out to try and puzzle it out.

RobotMush (Technical User) Self Taught
 
You may try this:
Private Sub Form_Current()
If Not Me.NewRecord Then
Call HypLnk_AfterUpdate
End If
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, I went in and made my chkHypLnk a unbounded check box and the program works. That is when I hyperlink the field to a file I get "pdf" in the File Type and a Check in the chkHypLnk Check box. That is until I click on the next field to do another hyperlink. Then the FileType clears and the chkHypLnk clears or becomes false.

Will try your suggestion. I'll let you know how it works.

RobotMush (Technical User) Self Taught


 
Ok y'all, the program is up and running, almost as needed. It is automatically making chkHypLnk as true, and putting "pdf" in the file type. However, the Filetype in the tblHyperlink is not being updated. This of course is due to the filetype textbox being unbound. When I try to bind it the program crashes.

What should be done now?

RobotMush (Technical User)Self Taught
 
I mean with the subform filetype field at present is an unbound textbox and the program is working. However when I try to bind the textbox to the FileType Field in my tblHyperlink then it crashes with...
"Run-time error '3327': Field 'FileType' is based on an expression and cannot be edited."
The program line that the error points to is...
"Me!FileType = Mid(strPath, 1 + InStrRev(strPath, "."))"

Any Ideas why this should be happening? I'm wanting my FileType field in my tblHyperlink to reflect the extension of the file I am hyperlinked to. This can be either "PDF" or "TIF"

Thanks for your help

RobotMush (Technical User)Self Taught
 
Field 'FileType' is based on an expression and cannot be edited
Which expression ?
The ControlSource should be the name of the field (in the subform's underlaying Table/Query) without any operator.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OK, Can you say MUD ON FACE? I went back to my query that my subform is based on and guess what. I didn't have the FileType form in there from the table but rather as an expression when I was trying to get the extension all in capital letters. Rectifying this by removing the the Expression FileType and installing the FileType from the tblHyperlink it is working beautifully now.
Sorry for the past few days of headaches.

RobotMush (Technical User) Self Taught
 
get the extension all in capital letters
Me!FileType = UCase(Mid(strPath, 1 + InStrRev(strPath, ".")))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Well, I kinda did that, what I entered was...
"Me!FileType = UCase(Left(Right(HypLnk,4),3))"
And that seems to do quiet well. However, if I used yours would that allow the chkHypLnk to click off in the event that I have to delete the hyperlinks to where non are Hyperlinked to that client?

Thanks so much for your help

RobotMush (Technical User)Self Taught
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top