Hi,
I have a command button on a form that the user can use to browse to a file and the user can select that file and a hyperlink to that file is stored in a txtfield for that record.
I then have a command button that a user can click to open and view the associated file.
This all works fine. BUT:
I would like the command button that allows the user to view the file to be hidden if no hyperlink was added. In other words the txtfield for the hyperlink IsNull.
Here is what I have tried with no luck: -
-
Private Sub txtSelectedFile_AfterUpdate()
-
If (Me.[txtSelectedFile]) = IsNull Then
-
cmdExplore.Visible = False
-
Else
-
cmdExplore.Visible = True
-
End If
-
-
End Sub
-
-
Thank you!!!
Thank you for all of the responses.
It now works with a combination of code, using the Form_Current():
Thank you!!! -
-
Private Sub Form_Current()
-
-
If Nz(Me!txtSelectedFile, "") = "" Then
-
Me!cmdExplore.Visible = False
-
Else
-
Me!cmdExplore.Visible = True
-
End If
-
-
End Sub
-
-
14 22043
Try this ... -
-
Private Sub txtSelectedFile_AfterUpdate()
-
If NZ(Me.[txtSelectedFile], "") = "" Then
-
cmdExplore.Visible = False
-
Else
-
cmdExplore.Visible = True
-
End If
-
-
End Sub
-
-
Thank you for the reply... But no luck. Command Button still visible when field is blank.
Add the Me! reference just in case there is a problem with the button name. -
-
Private Sub txtSelectedFile_AfterUpdate()
-
If NZ(Me!txtSelectedFile, "") = "" Then
-
Me!cmdExplore.Visible = False
-
Else
-
Me!cmdExplore.Visible = True
-
End If
-
-
End Sub
-
-
You should always add it anyway and if you run the debug option it will tell you if there is a problem with the reference. Otherwise check the textbox txtSelectedFile and see if it is holding any blank spaces.
I created a hyperlink table field named "x" and used in the InCurrent event: -
Private Sub Form_Current()
-
Me.x.Visible = Not IsNull(Me.x)
-
Me.Repaint
-
End Sub
-
And my x field was invisible when Null...
Nic;o)
Thank you for all of the responses.
It now works with a combination of code, using the Form_Current():
Thank you!!! -
-
Private Sub Form_Current()
-
-
If Nz(Me!txtSelectedFile, "") = "" Then
-
Me!cmdExplore.Visible = False
-
Else
-
Me!cmdExplore.Visible = True
-
End If
-
-
End Sub
-
-
Thank you all for your help....
One last question:
The screen only refreshes if I advance a record and then come back. Is there a way to "refresh" or "repaint" when this txt field is either null or contains data?
I am not sure what event to use or which field to call for such an event.
Thank you
In the after update event of the txtSelectedFile textbox try ...
This will re-run any and all code in the forms current event.
I have tried this but no luck -
Private Sub txtSelectedFile_AfterUpdate()
-
Form_Current
-
End Sub
-
Me.Refresh will clear out any unbound text boxes. If that is what you are trying to do. If you explain what it is you want to happen I might be able to help better.
msquared,
I have command button on a form that allows a user to browse to a file (doc, pdf, etc..)
The user chooses that file and a hyperlink for that file is stored in a txt field for the table
Then on the form there is a command button that allows the user to click and open the hyperlinked file.
Currently it is set up so if the hyperlink field is empty, the command button to view a file is not visible
This all works fine.
The ONLY issue is if:
The user clicks and adds the hyperlink; the “view” button is not visible until the user advances one record on the form and then goes back to the record in question.
Put the Form_Current command at the end of the code that adds the hyperlink to the field. It doesn't work in the AfterUpdate event because you never tab into that field so the event never triggers.
msquared,
I have put the Form_Current at the ned of the code to add the hyperlink... since no luck making the "View File" command button visible unless advance record and go back...umm... -
Private Sub CmdBuildingAdd_Click()
-
-
Me!txtSelectedFile = BrowseFiles()
-
variable = Me!txtSelectedFile
-
-
Form_Current
-
-
End Sub
-
While what you have posted will certainly work, it might clutter up things latter if you wish to add other code to your Form_Current that you might not like running after uses adds his hyperlink.
Instead add a procedure to your form: - Private Sub setLinkVis()
-
If Nz(Me!txtSelectedFile, "") = "" Then
-
Me!cmdExplore.Visible = False
-
Else
-
Me!cmdExplore.Visible = True
-
End If
-
End Sub
Then change your code to: - Private Sub CmdBuildingAdd_Click()
-
-
Me!txtSelectedFile = BrowseFiles()
-
variable = Me!txtSelectedFile
-
call setLinkVis
-
-
End Sub
And in your Form_Current: - Private Sub Form_Current()
-
call setLinkVis
-
End Sub
TheSmileyOne,
That did it. THANKS!!!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Xerxes |
last post by:
Hi,
can you tell me how I can make a <label> hidden?
I have hidden the field after the label:
var M_Hide = isNS4?'hide':'hidden';
var M_Show = isNS4?'show':'visible';
.....
<label...
|
by: DettCom |
last post by:
Hello,
I would like to be able to display or hide fields based on whether a
specific Yes/No radio button is selected. This is in conjunction with
a posting a just made here in the same group...
|
by: ATS |
last post by:
I need to hide/reveal parts of a web page using javascript. I think I can
do with using the <span> tag, but I've been away from it for a while and
don't remember. Any pointers, examples?
|
by: gbb0330 |
last post by:
hi all
first i would like to thank PC Datasheet, i got so far because of
him/her
i need some help again
i have this command button
the on-click event procedure is
|
by: Lauren Quantrell |
last post by:
I use the following code to create text edit fields and command buttons
in my toolbars:
Function CreateToolbarObject(myObjectType as integer)
Dim newObject
Select Case myObjectType
Case 1...
|
by: John Boy |
last post by:
Hi,
Can anyone help. This is really doing my nut in. 3 years ASP exp. and
now doing .DOT which is a step in the wrong direction.
Basically I am left with the code of a guy who has left. When I...
|
by: FP |
last post by:
I'm new to Java Script.
I'm displaying comments people have made. Below each persons' comment
I want to add 2 buttons "Reply" and "Amend". Clicking "Reply" would
display an empty text field...
|
by: toodi4 |
last post by:
I'm using a javascript that hides and unhides text based on a button
click. It works great across static fields on a form. The problem I
have is that I'm trying to hide and unhide various fields...
|
by: kevinpublic |
last post by:
I have an item list for ordered products on a data grid in VS 2003.
It's an ASP page running VB behind it. All detail lines display as
well as all shipping charges. On the edit screen, we allow...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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,...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |