[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 135
  • Last Modified:

Access and Visual Basic

I have a project.  I'm dowloading the files from a mainframe into an Access database.  I would like to have a progress bar where it tells you that this number file is done and then progresses to the next.  I need Access to update the form while doing this.   I need some help with this.  Can someone help me??? If you need more explanation just let me know.  Thanks!

Jen
0
nrok829
Asked:
nrok829
  • 7
  • 6
1 Solution
 
charlescopeCommented:
A progress bar is very simple to do with vb, is this what you having trouble with? If you are downloading txt files into a database you will need to know how large the file is  and then based on the bits recieve update the progress bar. I have code for a progress bar that I can post, but the hard part is finding out the file size unless it is in the header of the file like a word doc. Are we are on the same track?
0
 
nrok829Author Commented:
The files are not text files.  They are publisher files.  I think we are on the right track but we need access to update it since the module is in access.  The module in access is the one who is downloading the files.   Let me know if this is clear

Jen
0
 
charlescopeCommented:
Ok do you use vb as a front end to the access database?  What part do you need help with?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
nrok829Author Commented:
The files are not text files.  They are publisher files.  I think we are on the right track but we need access to update it since the module is in access.  The module in access is the one who is downloading the files.   Let me know if this is clear

Jen
0
 
nrok829Author Commented:
Yes I use vb as the front end.  But we use some mainframe stuff to upload the files and then the database takes over putting the files into the tables.  Know you don't know this is happening except for a progress bar now that sits not moving for a while.  This process takes a long time.  We want to be able to say that file 1 was put into the table and then it goes back to the access module.  we need to call the form from access and change it.

Jen
0
 
FalkeCommented:
Hope this helps: (If i have understood this in the right way)???

make a frame...
and add Progressbar1, make it invisible (frame)

when you want to show it:

Dim Progress_max as Long
Dim Progress as Long

frame1.visible=True
data3.recordsource="SELECT * FROM [table]"
data3.refresh
if data3.recordset.absoluteposition<>-1 then 'He has found something
data3.recordset.movelast
Progress_max=data3.recordset.absoluteposition
data3.recordset.movefirst

While not data3.recordset.eof
...
...
...

if  progress<val(((data3.recordset.absoluteposition/Progress)*100)) then
Progressbar1.value=(Data3.recordset.absoluteposition/Progress)*100
frame1.refresh
Progress=(data3.recordset.absoluteposition/Progress)*100
endif
data3.recordset.movenext
wend
frame1.visible=FALSE
0
 
nrok829Author Commented:
Actually, after having spoken to the developer my question should have been how do you update a progress bar on a VB6 form from a MS Access 2000 function? The function is in an access module and is called by my VB6 app. The function is doing a lot of things and I would like it to update the progress bar accordingy.
0
 
charlescopeCommented:
The answer is use Events. Some might say to use Callbacks but if a Event will work it a lot more fun. The MSDN has a topic called "Handling an Object's Events " that will walk you through the logic of using events. The example uses vb only but it will work with Access also, after you look it over if you still need some help I will be happy to help you with events or callbacks code.
0
 
nrok829Author Commented:
I went to the topic and am very confused. Are you saying that I can create a new event for an object on my vb6 form (the one that has the progress bar) and somehow have my access function set off the event to do something. My problem is I can't even see the vb6 form when executing the code in the access function. Can you please help me do that. Thanks!
0
 
charlescopeCommented:
Yes that is what I am saying! but the event is created in Access the server and the Client is your VB6 project which will display the progress bar. When using event the server don't care if the client deal with the event or not so it don't matter if you cant see vb from Access just fire the event. Then in the client is where you deal with the event the server has fired(Access) to update and display you progress bar. It take a little bit of study to understand the event but once you get the concept it a cake walk. Here is a web site that you can get the VB code and Slide for how events work. http://www.softwarepolish.com/vb/eventpre.htm In short what you do is in Access go to the Insert Menu and select Insert Class Mod then create as userdefined event in this new class. Then in the standard mod that handles the down load their is most likly some type of loop that down load the file inside that loop use the raiseevent key word to call your user defined event list above. Then in your VB6 project declare a variable with the withevents keyword something like Private WithEvents myAccessProgram  As Access Then where you call the Access program in VB replace the call with your new myAccessProgam  be sure to place some doevent and refresh as the progress bar does it work.
0
 
charlescopeCommented:
It look like I was wrong, I was talking this over with a friend and he said it would not work with events but only with callbacks. Here is his link to support his logic http://www.microsoft.com/SalesInfo/QA/QA7288.HTM 

Sorry!
0
 
nrok829Author Commented:
Thanks for the update. Without using withevents and/or raiseevents is there another way to update the vb form?
0
 
charlescopeCommented:
The way I would do it is pull the code out of Access and drop it into VB then you would be able to make changes easy. Just use Access as the backend database only. The VBA code should work in VB very well with little changes and use ADO to write the data to the database. The next way is to use Callbacks.
0
 
nrok829Author Commented:
Thanks for your help. That was exactly what I was thinking about doing. You've just confirmed it for me.
Thanks Again!!!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now