Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Create & Call upon activex progress bar Access 2007

Posted on 2009-06-29
12
Medium Priority
?
1,344 Views
Last Modified: 2012-06-27
I created a database, so far with one simple query which executes when i click on a button on a form.

I added an ActiveX Progress bar that i saw inside Access "Add-ins" and added it to the form but do not know how to bring it up, access it, or make it run.

Please help and provide step by step - Im new at this.Thanks!
0
Comment
Question by:romerica
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
12 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 24738825
You can only modify the setting of the progress bar when you have control of the process.
If you start a long query running then you don't get control again until it has finished.



0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24743837
^
Yes, you have to update the progressbar after each operation (10% done, 20% done, 30%done, ...ect)

Since you only have one operation (one query), this is meaningless.

BTW, trying to do this on a timer (The query takes about 10 seconds to run), is notoriously unrelaible, so don't even consider it.

;-)

JeffCoachman
0
 

Author Comment

by:romerica
ID: 24744680
Right now, its only one query.. this is just the beginning.
Just for giggles, how would i call upon to open and update this activex progress bar control?
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 24745675
Most Developers do not use the ActiveX control(s)  because of the versioning issues.

A great many developers us the Status bar, here is the popular link:
http://support.microsoft.com/kb/210474

;-)

JeffCoachman
0
 
LVL 77

Expert Comment

by:peter57r
ID: 24745966
I agree with Jeff that ActiveXes in Access are a potential trouble spot.

But here is an example anyway.
The code is in the form timer event.
db21.mdb
0
 

Author Comment

by:romerica
ID: 24749077
I still cant figure anything out. I added the coding per the KB article with no luck, and i dont know how to integrate the code from peter57r.

I want it to initiate once one of the buttons is clicked. ie. 1) User chooses a date 2) User clicks a button 4) Progressbar appears 5) Query appears.

Right now only the first button 401K works and is tied to a Macro which executes a query when clicking that button.

I am currently in the process of adding a query that goes through several table and have been sitting here 8min now waiting for it to finish.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24749735
romerica,

Nobody can know what you mean by: "no luck", unless you tell us.

Can you :
1. Explain or post the cdode you used
2. State what happened
3. State what did not happen

Or simply post a sample of your database.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24749795
Remember to *first* test the sample as it is presented in the link, this works fine for me.
0
 

Author Comment

by:romerica
ID: 24755016
sorry, i think i just dont know where to put the code.. here is what i have (see code below) I will post 2 seperate codes

Im trying to attach it to "Private Sub BTN_401k_GotFocus()" b/c i want it to execute when i click the button to run the query as part of the macro.
So I copied and pasted MS artice stated above there but am not too sure if i have to change any names...

Does that make sence?

Whenever i did that, it came back with an error with a portion highlighted


I also dont know what the article is referring to as "module".
formview.JPG
errorbox.JPG
codebuilder.JPG
0
 

Author Comment

by:romerica
ID: 24755030
ReportChooser Form Code:
Option Compare Database
 
Private Sub Text8_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(txtDateChooser) Then
   ocxCalendar.Value = txtDateChooser.Value
Else
   ocxCalendar.Value = Date
End If
End Sub
 
Private Sub ocxCalendar_Updated(Code As Integer)
 
End Sub
 
 
 
Private Sub BTN_401k_GotFocus()
Option Explicit
Function Meter()
   Dim MyDB As DAO.Database, MyTable As DAO.Recordset
   Dim Count As Long
   Dim Progress_Amount As Integer, RetVal As Variant
   
   Set MyDB = CurrentDb()
   Set MyTable = MyDB.OpenRecordset("Customers")
 
   ' Move to last record of the table to get the total number of records.
   MyTable.MoveLast
   Count = MyTable.RecordCount
 
   ' Move back to first record.
   MyTable.MoveFirst
 
   ' Initialize the progress meter.
   RetVal = SysCmd(acSysCmdInitMeter, "Reading Data...", Count)
 
   ' Enumerate through all the records.
   For Progress_Amount = 1 To Count
     ' Update the progress meter.
      RetVal = SysCmd(acSysCmdUpdateMeter, Progress_Amount)
      
     'Print the contact name and number of orders in the Immediate window
      Debug.Print MyTable![ContactName]; _
                  DCount("[OrderID]", "Orders", "[CustomerID]='" & MyTable![CustomerID] & "'")
 
     ' Goto the next record.
      MyTable.MoveNext
   Next Progress_Amount
 
   ' Remove the progress meter.
   RetVal = SysCmd(acSysCmdRemoveMeter)
        
End Function
 
End Function
 
Private Sub ProgressBar_GotFocus()
 
 
End Function

Open in new window

0
 

Author Comment

by:romerica
ID: 24755038
ProgressBar Form Code:
Option Compare Database
 
Private Sub Detail_Click()
Private Sub Form_Open(Cancel As Integer)
 
    Meter
 
End Sub
 
End Sub

Open in new window

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24756185
romerica,

The code you posted is all over the place.

First, realize that what you have asked for here *requires* you to be familiar with VBA and coding.

So in this code:

Option Compare Database
 
Private Sub Detail_Click()
Private Sub Form_Open(Cancel As Integer)
 
    Meter
 
End Sub
 
End Sub

...You have wrapped a sub in a sub
Do you want the code to run on the click event of a button or on the Open event of the form?

It should look like this:
 
Private Sub Detail_Click()
     Meter
end Sub

Or this:

Private Sub Form_Open(Cancel As Integer)
    Meter
End Sub
 

The words:
Option Explicit
Option Compare Database

...will only appear once, ...at the top of all the code.

Perhaps another Expert can get you sorted out.
I would have to see a sample of this database

JeffCoachman
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question