Hiding a button on a form before copying database

MS Office Access

    Next

  • 1. Dividing one text field into several text fields.
    I have an access database with a text field that reflects names: eg. first name, last name, ini, prefix - Doe, John, M., Mr. How can I globally break this field into individual fields such as: [firstname],[lastname],[ini],[prefix]? I look forward to your professional assistance.
  • 2. grey out 2 combo text boxes unless checkbox=True
    Hi, is it possible to grey out 2 combo text boxes to prevent data entry if a checkbox is set to False? If checkbox is set to True, permit data entry. Also, if the checkbox is changed from True to False while data is in the 2 combo boxes, I would like a MsgBox asking for confirmation from users to delete this data. Can I create a single On Click VBA script that does all of the above? Thanks! -Lynn
  • 3. Form will not display decimal Places
    Hi I have a db that records holidays the table will let me enter part days i.e 1.5, but in the forms I can enter decimal places but it rounds it back to whole numbers. The numbers entered in the tables i.e. 1.5 displays as 1 in the form. What am I doing wrong? Thanks Bob

Hiding a button on a form before copying database

Postby rhese » Thu, 26 Jun 2008 00:50:34 GMT

've got a database system that is composed of 3 levels of databases:
National, State, and Local. Each mdb is an exact copy of the other,
except for the amount of data contained. The National contains all
records, the State - only records for that state, and the Local - only
records for that office. The table structure and all the forms & code
are the same.

The National and State level databases have a button that allow the
user to export out the next lower level. i.e., National wants to
create new State-level databases and State-level wants to create new
Local-level databases, and I have code that will do this splendidly.
However, the same "Export Sub Databases" button shows up in the Local-
level database, and my client is concerned this will cause confusion.

I have tried to code in a routine at the beginning of the Export Sub
Databases process that hides the button in the current (State-level)
database before using an iterative .Copyfile loop to create the Local-
level databases, and then restore the button at the end of the Sub.
But, even though the button does disappear in the current database
before the copying begins, it is still visible in each Local-level
database.

Can anyone tell me why this doesn't work? I'm working in Access 2003
but saving these databases as Access 2000. Below is the code, with
the portions dealing with hiding the button bracketed by "***". Thank
you for any help you can provide.

--Rhese

Private Sub bExportLocal_Click()
On Error GoTo bExport_LocalErr
Dim strSQL As String
Dim strDelSQL As String
Dim strLocal As String
Dim strState As String
Dim strSourceDb As String
Dim strDestinationDb As String
Dim strPath As String
Dim intRev As Long
Dim fs As Object
Dim qdfLocals As QueryDef
Dim rstLocals As DAO.Recordset
Dim rsState As DAO.Recordset
Dim dbLocal As Database

DoCmd.Hourglass True
'****************************************************
'Temporarily hide the Export Sub Databases button on fExport_Database
in the current database
'so it won't show up in the local databases.
Forms!fExport_Database!bExit.SetFocus
Forms!fExport_Database!bExportSubs.Visible = False
Forms!fExport_Database!lblExportSubs.Visible = False
Forms!fExport_Database.Repaint
DoCmd.Save acForm, "fExport_Database"
'****************************************************
'Get the name and path of current database
strSourceDb = CurrentDb().Name
intRev = InStrRev(strSourceDb, "\", , 1)
strPath = Left(strSourceDb, intRev)

'Get unique list of Offices for this State that have data
strSQL = "SELECT tSpecies_In_FDOffice.OfficeCode FROM
tSpecies_In_FDOffice " & _
"GROUP BY tSpecies_In_FDOffice.OfficeCode ORDER BY
tSpecies_In_FDOffice.OfficeCode;"

Set qdfLocals = CurrentDb().CreateQueryDef("", strSQL)
Set rstLocals = qdfLocals.OpenRecordset(dbOpenForwardOnly)

'Figure out which State this is
strLocal = rstLocals![OfficeCode]

Set rsState = CurrentDb().OpenRecordset("tFD_Offices", dbOpenDynaset)

With rsState
.FindFirst "[OfficeCode] = " & "'" & strLocal & "'"
strState = ![StateCode]
.Close
End With

'Loop though Local Offices and make copies of the database with the
State and Office as part of the name
With rstLocals
While Not .EOF
strDestinationDb = strPath & strState & "_" & strLocal & "_" &
Str(Year(Now())) & ".mdb"
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile strSourceDb, strDestinationDb

Re: Hiding a button on a form before copying database

Postby Jeff Boyce » Thu, 26 Jun 2008 01:19:21 GMT

hese

If you export a copy of some of the data from your top level, and then the
top level data is changed, how do the lower levels get re-synchronized?

If your exported copies (i.e., lower levels) are updated due to State and/or
Local conditions, how does the National level get re-synchronized?

When you say you are exporting subsets of data, are you sending those State
and Local databases off to State/Local users, or are you using this
mechanism to narrow the scope of what you are looking at? (if the latter,
you can much more easily do this with queries)

More info, please...


Regards

Jeff Boyce
Microsoft Office/Access MVP

< XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...



Re: Hiding a button on a form before copying database

Postby rhese » Thu, 26 Jun 2008 01:50:31 GMT

Hello Jeff,

Re-synchronization will only happen once a year.  First, the Local-
level databases are distributed to each local office, where that
year's data gets entered.  Each office then sends their database to
the State-level office.  There also is code that imports the changed
records from each Local-level database to the single State-level
database.  The State Office then reviews the data and makes any
necessary corrections.  The National Office then gets all of the
reviewed State-level databases, the records of which they can then
import into the single National-level database.  Then when the next
fiscal year comes around, the National exports out the State
databases, passes those on to the State Offices, who then export out
the Local-level databases and passes those on to the Local Offices.

Believe me, I realize this is not the most efficient way do to this,
and a single networked database or possibly partial replications would
be better, but this is what the client wants to do and what I have to
work with.  So, the screwy process aside, any clues as to the specific
code issue?

Thanks for your time.

--Rhese




Re: Hiding a button on a form before copying database

Postby Jeff Boyce » Thu, 26 Jun 2008 02:19:19 GMT

OK, sounds like you've covered the synch issues... (I had to ask, it's what 
I do...<g>)

One approach, off the top of my head, would be to hide the button for 
everyone, but offer a way to enable it.  The trick to enabling it would be 
something you'd only share with the folks who had 'need to know'.  One way 
would be to create a pseudo-login popup and collect a UserID/Password and 
compare them against a valid combination in your code.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP






Hello Jeff,

Re-synchronization will only happen once a year.  First, the Local-
level databases are distributed to each local office, where that
year's data gets entered.  Each office then sends their database to
the State-level office.  There also is code that imports the changed
records from each Local-level database to the single State-level
database.  The State Office then reviews the data and makes any
necessary corrections.  The National Office then gets all of the
reviewed State-level databases, the records of which they can then
import into the single National-level database.  Then when the next
fiscal year comes around, the National exports out the State
databases, passes those on to the State Offices, who then export out
the Local-level databases and passes those on to the Local Offices.

Believe me, I realize this is not the most efficient way do to this,
and a single networked database or possibly partial replications would
be better, but this is what the client wants to do and what I have to
work with.  So, the screwy process aside, any clues as to the specific
code issue?

Thanks for your time.

--Rhese






Re: Hiding a button on a form before copying database

Postby rhese » Thu, 26 Jun 2008 02:41:10 GMT

Hmm, well, that's a concept.  There is already a user tracking log in
screen.  I'll run it by the bigwigs and see what they think.  Still
wish I knew why my code doesn't do what I expect it to, though.

Thanks again Jeff.

--Rhese





Similar Threads:

1.Hide Button after clicking on the button to open a form

Hi,

Please let me know how i can hide a button after clicking on the same 
button.  I am able to click on a button and hide another button but does 
Access allow you to hide the same button you just clicked on?

I used the following code to hide another button but why can't I hide the 
same button:
Me.Command30.Visible = False

Thank you so much.

2.Open database window from hidden button

I have now used the following code from Allen Brown to open my mde database
from a hidden button:

DoCmd.SelectObject acTable, , True.

My problem now is that I can't get the normal top menu that you get when you
open Access with the shift key down.  Is there any way in code of getting
that menu to show.  The one with File Edit View Insert Format Tools Window
Help

dixie


3.copying buttons from form to form

Hi Access Gurus,
   In Access 2002 when I copy a button from one form to another, it doesn't 
work in the latter form.  On the first form, the button invokes a report. 
Any ideas? 


4.Copy table form BE database to BE database

I developed a program that will be deployed in Latin America that has 
multiple language capabilities.
I stored the captions in a table in the BE database for each language 
(English, spanish, and Portuguese).
To create a new language (there is interest to use the application in Europe 
too), I need to create a new table (TableNew) from one of the existing 
languages (TableRef) to translate.
To do this I wrote the code:

        DoCmd.TransferDatabase acExport, "Microsoft Access", _
                               BEPath & "Myfile.mdb", acTable, _
                               TableRef, TableNew, False
        
        CurrentDb.TableDefs(TableNew).RefreshLink

The first line is suposed to create the copy, but it only places a link to 
TableRef named TableNew, instead of creating an entirely new table.
Since the table does not exist, the refreshlink action does not work either.
Ideas?

5.button to show/hide delete buttons

I have a form with 3 sub forms nested
f0Site, f1Customer, f2PlantSub, f3UnitSub
F0Site holds f1Customer
f1Customer holds f2PlantSub
f2PlantSub holds f3UnitSub

Each form has a delete button. btnDelSite, btnDelCust, btnDelPlant and 
btnDelUnti
I need a button on f0Site form that will show/hide the delete buttons within 
each form.

A button to show and hide the delete buttons... eeek
-- 
deb

6. hiding Calender Form button

7. Hide Navigation Buttons at Bottom of Form

8. Hide or show Control Button on Form in Access 97



Return to MS Office Access

 

Who is online

Users browsing this forum: No registered users and 57 guest