Form assistance

skinny220

New Member
Joined
Jan 10, 2015
Messages
34
Would it be possible to to customize an access form to show rather a table has been imported with a green check or “LOADED”. If the table has not been loaded it will stay blank. If this is possible can you point me in the right direction?

Example: File 1: "Loaded" 
File 2: "stays blank cause its not loaded"
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
It is possible to iterate through the database objects (in your case, table container) to find a particular one. So there's the rub - will it always have the same name? If not, something about your form has to allow the user to, or cause the table to, be identified. If it's a user action, it could be based on some combo box selection for example.

As for a green check, a checkbox does not have a background colour property AFAIK, but you can put a rectangle behind it, which you'd colour green. Or you can change the attached label for the checkbox to say LOADED if you wish. All of this would require a procedure on the form. If you intend to use this on more than one form, it would be better to put the code in a standard module so that all forms that need it can access it.

To go any further, you'd have to tell us/me how to identify the table that is the subject table. This forum does not allow you to upload a copy of your db, so you'd have to be able to post relevant code that exists behind the form. You also asked for pointers, so try searching for 'MS Access loop table def' . Here is some air code that you could use in a function to return True or False (TRUE = table has been imported; FALSE = has not been imported). Note: no error handling supplied at this point

Code:
Function TableExists() as Boolean 'table name as parameter in brackets if this is a volatile parameter
Dim db As DAO.Database
Dim tdf As DAO.TableDef
TableExists = False
Set db = CurrentDb
For Each tdf In db.TableDefs
 If tdf.Name = "nameOfSubjectTable" Then
   TableExists = True
   Exit Function
 End If
Next
End Function
Whatever calls this function gets either True or False as a result, so the checkbox is set to True or False accordingly.
 
Last edited:
Upvote 0
Micron,

A check box sounds what I'm looking for would I be able to use below code to do this this function. I have two tables (CW1 and CW2) that I would like to use the check box method on a Form.
 
Upvote 0
Micron,

A check box sounds what I'm looking for would I be able to use below code to do this this function. I have two tables (CW1 and CW2) that I would like to use the check box method on a Form.
What 'below' code?
 
Upvote 0
Micron,

I meant the code you sent in initial:

Function TableExists() as Boolean 'table name as parameter in brackets if this is a volatile parameter
Dim db As DAO.Database
Dim tdf As DAO.TableDef
TableExists = False
Set db = CurrentDb
For Each tdf In db.TableDefs
If tdf.Name = "nameOfSubjectTable" Then
TableExists = True
Exit Function
End If
Next
End Function
 
Upvote 0
I believe so, but you will have to be clear on exactly what it is you are doing / want to do. While doing that, go back to post #2 and ensure you answer the questions AND provide information about the things already noted.
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,250
Members
451,757
Latest member
iours

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top