Go Back   Access World Forums > Apps and Windows > Visual Basic

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-18-2018, 04:17 AM   #1
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
VBA, I desperately need help.

I have built an Assess database with various forms and in the process of expanding it to cover everything I need to do with it.

I'm at the point where before I proceed I need to be able to select a group of record.

There are about 30 fields in each record, some of which contain data from lookup table, another holds attached photos but the majority hold data from the table itself.

One from displays all the fields to allow data entry.

I can, by using the Filter option of ADVANCED, CLEAR ALL FILTERS then ADVANCED, FILTER BY FORM, than after entering one or more items of data in the form by typing in a data field - use drop the down box or click the radio button in the option group and clicking TOGGLE FILTER, have selected all the matching records.

This works perfectly for me but as there may/will be other users the ribbon etc. will be hidden preventing alterations to layout etc. I need a FIND MATCHING RECORDS button to switch from the menu to the search form then something to toggle records so all are selected (toggle filter) and another button to clear selected and start another search if required.

As the only bit of VBA I've managed to get to work is DoCmd.OpenForm "permissions", acNormal (found on internet lol) I don't hold out much hope of finding out how to do this myself.

Anyone help a COMPLETE BEGINNER?

Dangerous is offline   Reply With Quote
Old 10-18-2018, 04:43 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,339
Thanks: 0
Thanked 737 Times in 722 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: VBA, I desperately need help.

do you want boxes to use to filter like:
cboState , user enters a state
txtLast, user enters a persons last name
etc...
btnFilter, click to filter the records on these values?
It CAN be done with vb code...but

rather than build all that, cant the user just right click on State field , filter, entery code,
then right click on LastName , then filter on the name?

zero code, same results.
Ranman256 is offline   Reply With Quote
Old 10-18-2018, 04:57 AM   #3
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
Re: VBA, I desperately need help.

I don't know how best to do what I want.

I can do what I need to by using the sort & filter commands on the ribbon but as the ribbon will be hidden (plus I won't want people to have to read or remember the steps every time) I need it to be automated.

I don't know exactly what you mean by STATE FIELD.

Dangerous is offline   Reply With Quote
Old 10-18-2018, 05:00 AM   #4
jdraw
Super Moderator
 
jdraw's Avatar
 
Join Date: Jan 2006
Location: Ottawa, Ontario, Canada;West Palm Beach, Florida
Posts: 12,060
Thanks: 79
Thanked 2,003 Times in 1,951 Posts
jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light
Re: VBA, I desperately need help.

I recommend you tell us about the application in simple plain English. You could also post a copy of your database in a ZIP file.
Good luck.
__________________

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.
jdraw is offline   Reply With Quote
Old 10-18-2018, 05:19 AM   #5
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
Re: VBA, I desperately need help.

Assume the database is a list of photos.

It could contain the following (and more)

Title
Location
Photographers Name
Camera used
Lens used
Thumbnail of photo
Option Box, select radio buttons for landscape, cityscape, portrait, nightscape (one option only)
Option Box, select radio buttons for trees, rivers, cars, wildlife, buildings, flowers (multiple options

Then I may need to find & display all records (one per page) that were taken near Falkirk - taken by fred - using his Canon XXX camera - and showed both trees & rivers.

Then repeat the filter for all photos that matched other criteria (after clearing previous filter)
Dangerous is offline   Reply With Quote
Old 10-18-2018, 06:56 AM   #6
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
Re: VBA, I desperately need help.

I might be able to figure it out if I could convert the built in macros to VBA, that's the ones on the ribbon
especially those groups in the Sort & filter section.
Dangerous is offline   Reply With Quote
Old 10-18-2018, 07:49 AM   #7
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
Re: VBA, I desperately need help.

I have found that the "Filter by button" option shows as Filter By Form (FilterAdvancedByForm) when hovered over in the Customize the Quick Access Toolbar but I've not been able to run that no matter what I've tried. If I could figure out the correct way to do that then the other commands could be added and it may work for me.

Can anyone help?

Dangerous is offline   Reply With Quote
Old 10-18-2018, 09:11 AM   #8
jdraw
Super Moderator
 
jdraw's Avatar
 
Join Date: Jan 2006
Location: Ottawa, Ontario, Canada;West Palm Beach, Florida
Posts: 12,060
Thanks: 79
Thanked 2,003 Times in 1,951 Posts
jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light
Re: VBA, I desperately need help.

I recall a photo with attributes question
https://www.access-programmers.co.uk...d.php?t=276886

A lot of what you need seems to focus on the kind of question/searches you want to be able to do. This involves assigning several meaningful attributes from some ultimate list. Then your search/filter can be assembled in some form and the results obtained.

If you zip your database, I think you should be able to attach it. You may get more focused responses this way.
__________________

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.
jdraw is offline   Reply With Quote
Old 10-18-2018, 09:20 AM   #9
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 10,055
Thanks: 110
Thanked 2,727 Times in 2,490 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: VBA, I desperately need help.

Will the information in the list you gave in post 5 be stored as fields in a table ...or are you expecting to extract this data from the EXIF data in the image itself?

If the latter you might find it useful to extract the extended properties (AKA file attributes) for each image file. I have an example app you can use to do that.
See http://www.mendipdatasystems.co.uk/e...ies/4594398115.
Its also here: https://www.access-programmers.co.uk...d.php?t=294548
__________________
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 10-18-2018, 09:38 AM   #10
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
Re: VBA, I desperately need help.

That was an example rather than the actual data names. All data will be entered in to fields in a table and displayed on a form. In total there are 20 fields with a few more required.

Object of the filter is to select only the records that match all of the search criteria which could be data in one or more than one field.

In the example it could just be all photos taken by fred or all by fred that are landscapes.

Edited to add: In the actual database the photo is just a piece of date and may be omitted from the record if not required rather than what the record is about.
Dangerous is offline   Reply With Quote
Old 10-18-2018, 11:14 AM   #11
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 10,055
Thanks: 110
Thanked 2,727 Times in 2,490 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: VBA, I desperately need help.

Ok there are two things here.

1. Entering the data for each photo into Access for which using the extended properties should be a significant help.

2. Filtering the data using the selections made in multiple combo boxes.
To do that you will need to build the WHERE part of your query SQL concatenating the output from each.

As we don't know your field names and datatypes, I suggest you start by looking at this article by Allen Browne on creating a search form http://allenbrowne.com/ser-62.html
__________________
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
The Following User Says Thank You to isladogs For This Useful Post:
Dangerous (10-18-2018)
Old 10-18-2018, 12:10 PM   #12
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
Re: VBA, I desperately need help.

Had a look at that info, To me it's all double dutch (translated to Martian by a Klingon lol).

Up to now the only thing I have managed to do is the reset filter and have changed it so it selects all records rather than none.

I'll keep looking but first impressions it won't give the results I need as it says one record per ling & I need 1 per form/screen.

Thanks for trying , Is there any basic VBA tutorials for a total beginner?
Dangerous is offline   Reply With Quote
Old 10-18-2018, 12:22 PM   #13
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
Re: VBA, I desperately need help.

It wouldn't help me giving field names as there will be over 20 and filtering could be done on from any 1 to 12 fields out of 20 or more.

Fictitious field names of F1 to F25 in a routine would do and I'd adapt to suit.

To be perfectly the build in filter commands work perfectly but as I say the ribbon will be hidden so calling them, one seems to be called FilterAdvancedByForm, by clicking a button (text or icon) placed on the form would be perfect.
Dangerous is offline   Reply With Quote
Old 10-18-2018, 01:53 PM   #14
Dangerous
Newly Registered User
 
Join Date: Oct 2018
Posts: 71
Thanks: 15
Thanked 0 Times in 0 Posts
Dangerous is on a distinguished road
Re: VBA, I desperately need help.

Isladogs.

I've found how to call filterByForm by clicking text with assigned event but once the records are found I can't do anything other than entering a search term in a field box. I can of course click the ApplyFilter button on the ribbon at which time any buttons or clickable text becomes active again, until then they are greyed out.

Tried Esc., Enter, etc. but they do nothing till I click a ribbon button to apply the filter.

Any Ideas?
Dangerous is offline   Reply With Quote
Old 10-18-2018, 02:42 PM   #15
jdraw
Super Moderator
 
jdraw's Avatar
 
Join Date: Jan 2006
Location: Ottawa, Ontario, Canada;West Palm Beach, Florida
Posts: 12,060
Thanks: 79
Thanked 2,003 Times in 1,951 Posts
jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light
Re: VBA, I desperately need help.

Post a copy of the database to get more focused responses.

__________________

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.
jdraw 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
Need help desperately aahna Introduce Yourself 0 03-30-2013 04:26 PM
Newbie Desperately Needs Help PLEASE Mansel160 Forms 6 02-18-2008 02:48 AM
Desperately in need of help Brad108 Forms 13 02-04-2007 02:55 PM
Desperately Need Help darkproject General 4 08-14-2003 08:31 AM
Desperately Need Help. Gumby General 4 09-10-2002 12:32 PM




All times are GMT -8. The time now is 12:34 PM.


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