Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-15-2019, 03:08 AM   #1
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Next task

Ok, so I have now got a working image database that works a charm. I have successfully added various check boxes and search (filter) criteria using what I learnt so far from help on this forum so I'm very happy!

My next task is to have a button appear if a check box on a row is checked; there are multiple rows on my form and I only want the button to appear on lines where that tick box is checked.

Ultimately, the button in question will be clicked for users to open a .PDF file; the path of which is stored in the table for this form.

I have been using the following syntax but can only make the button appear on ALL lines or none of them.


If Me.Check60 = -1 Then
Me.Command62.Visible = True
Else
Me.Command62.Visible = False
End If


Excuse the naming, but Check60 is the tickbox in question, and Command62 is the button I want to appear.

The tick box is automatically checked based on information in the table; nothing is "updated" as such when the form is being viewed.

I have read on some websites that this simply isn't possible - buttons can only be shown "all or nothing"... is that true? I cant find an alternative solution without having the full path of the PDF file shown - which to me just looks untidy (hence why I want to swap it to a simple button).

Thanks as always,
Chris

ChrisC is offline   Reply With Quote
Old 08-15-2019, 03:13 AM   #2
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Next task

If you are using a continuous form, there is actually only one set of controls but displayed multiple times. This means the buttons are indeed all or nothing.

However you could use conditional formatting to disable a textbox control where your checkbox is false...but CF isn't available for buttons

BTW I woulds use meaningful names rather than Check60, Command62 etc
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by isladogs; 08-15-2019 at 03:16 AM. Reason: Correction
isladogs is offline   Reply With Quote
Old 08-15-2019, 03:18 AM   #3
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,596
Thanks: 59
Thanked 2,435 Times in 2,335 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Next task

if it is a continuous form that you have, you can't.
try replacing the command button with unbound textbox or label and use conditional format to change its font's forecolor.

__________________
"Never stop learning, because life never stops teaching"
arnelgp is online now   Reply With Quote
Old 08-15-2019, 03:20 AM   #4
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Next task

Arnelgp
You can't use CF on a label
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 08-15-2019, 03:30 AM   #5
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: Next task

Hi Colin,

Thanks, at least that stops me going round in circles for hours ha ha.

Conditional Formatting is greyed out for buttons, so I'm presuming that simply some controls can not have formatting applied?

thanks

PS - names changed now
ChrisC is offline   Reply With Quote
Old 08-15-2019, 03:31 AM   #6
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: Next task

Quote:
Originally Posted by arnelgp View Post
if it is a continuous form that you have, you can't.
try replacing the command button with unbound textbox or label and use conditional format to change its font's forecolor.
Hi Arnelgp,

I will give that a try - thank you

I guess that would get around not being able to apply formatting to a button... make something else look like a button instead.

thank you
ChrisC is offline   Reply With Quote
Old 08-15-2019, 03:39 AM   #7
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Next task

Hi Chris
Conditional formatting is used for textboxes and comboboxes.
AFAIK it doesn't work for any other types of controls.

People often use labels in place of buttons but that won't help in your case as you can't apply CF to a label as stated above

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 08-15-2019, 06:20 AM   #8
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: Next task

thank you all - I have got the text box to be active/not-active based on the tick box value; but is there a way to make the greyed out, non active text boxes completely invisible?
ChrisC is offline   Reply With Quote
Old 08-15-2019, 07:14 AM   #9
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,822
Thanks: 107
Thanked 2,660 Times in 2,434 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Next task

You canít hide objects using CF. However you could make the text box fore colour and back colour the same as your form colour

If so you wonít need to disable them as well
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by isladogs; 08-15-2019 at 08:07 AM.
isladogs is offline   Reply With Quote
Old 08-15-2019, 10:06 AM   #10
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 27,808
Thanks: 13
Thanked 1,510 Times in 1,436 Posts
Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all
Re: Next task

The checkbox sounds redundant. Are you setting the checkbox to true for those items that have PDF's?

I would create a query with a calculated column:

Select ...., IIf(IsNull(PDFpathname, null, "Open") as HasPdf From yourtable

Bind a text box to the HasPDF field. All the values will be spaces or Open. set the format to display as HyperLink so the "Open" looks clickable. You will need code in the click event to ensure that there is a PDF address prior to using the FollowHyperLInk method just to avoid an error if someone clicks on the "empty" box.

PS - rather than apologizing for the poor control name, try to get into the habit of making sure controls are named correctly when you create them. If you drag a field from the available fields list, Access will give your control the name of the bound field. However, when you pick controls from the ribbon, Access doesn't know whether they will ever be bound or what column they will be bound to so it just names them text123. As soon as you add the control, do not pass go, do not collect $200, immediately rename the control so you don't have to come back to it later
__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
The Following User Says Thank You to Pat Hartman For This Useful Post:
ChrisC (08-15-2019)
Old 08-15-2019, 11:14 PM   #11
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: Next task

Hi Pat,

You're correct about the checkbox; it is simply to show whether "that" line has a PDF - but now you highlight it, I guess it is redundant. The checkbox is never updated from within the form - it is simply there as an instant visual aid to whether there is a file or not.

Forgive my ignorance - in a Query, how do I enter a calculated field? That is to say - where do I enter the calculation? Using the wizard I have a query that now shows 2 columns: the PrimaryKey, and one showing the PDF path if there is one, or simply blank if there isn't.

I must admit, "normally" in everything else I do, I do rename things to something meaningful from the start. This time I just didn't do it for some reason (probably because im rushing between this and doing my job!). Thank you though for the heads up - you are of course correct; naming things straight away is the best policy every time


Thanks
Chris
ChrisC is offline   Reply With Quote
Old 08-16-2019, 03:22 AM   #12
ChrisC
Newly Registered User
 
Join Date: Aug 2019
Posts: 19
Thanks: 5
Thanked 0 Times in 0 Posts
ChrisC is on a distinguished road
Re: Next task

Well I would say that I have achieved (sort of) what I want - certainly good enough to be able to move on with the project!

So thanks once again to all for the help!

Watch this space for the next cry for help... working out how to do a query to show for a given partID (entered in a text field) all the WHLocat (warehouse locations) that are associated with the Part and the qty in each of those locations (quantity and locations stored in a new table).

I think that will be for a different thread though (after I have had a go myself of course )

thanks everyone
Chris
ChrisC is offline   Reply With Quote
Old 08-16-2019, 04:35 AM   #13
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 27,808
Thanks: 13
Thanked 1,510 Times in 1,436 Posts
Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all
Re: Next task

In my post, I showed how to create a calculated field in a query. You can do it in QBE view but that' too hard to see here so switch to SQL View, find the end of the select clause, add a comma, then the new field. The dots in the example are what already exists of your query. You will also have to change PDFPathName to whatever you called that column.

__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Task simon4amiee Tables 8 03-19-2009 05:39 AM
Task bar help Kenln Modules & VBA 2 12-07-2006 01:14 PM
Task bar - app - MS acess pacg Modules & VBA 1 12-09-2005 11:15 AM
task description rather than task ID datacontrol Reports 3 10-21-2003 09:21 AM
Task Bar Help Andrea Lazenby General 1 10-21-2002 10:27 AM




All times are GMT -8. The time now is 01:36 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World