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
 
Have you tried using TRUE or FALSE instead?

Check boxes are boolean in nature and use TRUE/FALSE (TRUE being checked), they also correspond to -1,0....but I find the true false is simplist to remember..
 
Yes I have Knicks, in fact this is a second thread from my first one (Thread 702-1218279) of not being able to have my checkbox switch itself to true when the criteria is met.

This is the program I first started out with...

Private Sub chkHypLnk_AfterUpdate()
If IsNull([HypLnk-sfrm].[HypLnk]) Then
Exit Sub
Else
chkHypLnk = True
End If

End Sub

Where the check box in my form would check the field in my sub-form for the criteria. If it has something in it then it would make the check box true.
However, with the difficulties I have had with it I decide to use the MsgBox command to see what was happening. Which was nothing. So I am now wondering if I have the program wright or need to rethink of how to get my checkbox to work properly.

Thanks for your help

RobotMush (Technical User) Self Taught





 
Have you tried a msgbox on top of ur code, seeing if its at least getting executed, if so, have you checked which part of ur IF that is not working.... because it is most likely a simple problem like that... so put msgboxes everywhere, inside and out of ur function, see if it at least gets executed... but looking at that small amount of code I don't see what use it has, can you put it into context... ? (try refering ur null as "" if char$)
 
Thanks for your suggestion Hard, your talking a bit over my head when you say putting a msgbox on top of my code. as well as trying to refer my null as "" if char$
Let me try what I think you are telling me and I'll get back to you.

Thanks for your help and suggestions.

RobotMush (Technical User) Self Taught
 
char$ I meant string, and msgbox in front of ur if in ur private sub, sry for wrong specifications
 
Seems you choose the wrong event procedure ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That's a possibility PHV, however, I have tried it in AfterUpdate event, BeforeUpdate event, On Change event and On Enter Event. I get no messages from my program that tells me it is running. I guess I'll have to give up and just remember to click on the check box when I start hyperlinking the data.

Thanks for your help

RobotMush (Technical User) Self Taught
 
just remember to click on the check box when I start hyperlinking the data
how do you hyperlink the data ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I think the problem is that all these events only fire when the file name is changed, which is probably after a file name is entered. You need to pick some other suitable event, such as On Current.
 
Thank you Remou, I'll try that one. Whatever the event, it is not triggering the running of the program.

PHV: I Hyperlink the data by right clicking on the field that I want.
Highlight the Hyperlink choice.
Click on Edit Hyperlink.
Click on File.
Find the File I am wanting to Hyperlink to.
Click Ok
Click Ok
The Result is that the Hyperlink file that I had clicked on is listed in the field by a long name. I.E.
Server\Drive\Directory\ClientName\Year\Dept\subdirectory(ies) if applicable\File Name.extension
The FileType field shows "#Error" until I click the mouse again. Then is shows the file extension that I hyperlinked to. Usuall PDF or TIF

Hope that helps to explain things.

RobotMush (Technical User) Self taught
 
Does the AfterUpdate event of the field that shows the long name fires ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
By fires, do you mean runs the program? No it does not, if it means I am able to click on it and bring up the pdf or tif file? Yes it does do that

RobotMush (Technical User) Self Taught
 
Yes it does, but the for some reason the program I have created to check to see if the programs If then Else statement runs properly does not.

RobotMush (Technical User) Self Taught
 
In the AfterUpdate event procedure of the hyperlinked field set the value of both the FileType control and the CheckBox.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I still did not get if you could at least get the event to work or not.... if you can, then the problem is obviously in ur criteria.... either hyplnk is always null, or I really don't know.....

PHV is really better in helping anyway hell sort it out.
 
ItIsHardToProgram:
I am able to get the hyperlink to work.
From that I do a Right(text,4) Left(Text3) to get the Extension to put in the File type.
The Program I have written to see what happens does nothing during all this. I think the filetype field, which is what I am checking for my crietira is never null. At the begining it shows "#Name" in the field. When I get the hyplerlink made it shows "#Error" and when I click the mouse again it shows the extension of the Hyperlink. Either PDF or TIF.

Don't know if the clears things up or muddies them more.

RobotMush (Technical User) Self Taught
 
Thats probably very stupid, txtbox being to small for entry. but i don't see what problem u have since ur txtbox obviously gets filled....
 
What is the ControlSource of the FileType control ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top