DLDB.zip
Attached is my Access Database.
DLDB.zip
Attached is my Access Database.
I will be back on around 8A.M. CST Tomorrow I will get your reply and see about it tomorrow. Thanks.
How do you manage to run code in this database? When I try to open the progress bar form, I get error message that code must be updated for use on 64-bit systems. I've been getting this a lot this week. Review http://support.microsoft.com/kb/983043
I fixed that line and now I get "Method or data member not found". Status is not a label control it is a textbox. Textbox does not have a Caption property, label has Caption property, textbox has Value property. So change the code or change to a label. The code references controls named L1, L2, L3, L4, L5 which don't exist. The controls are named L6, L7, L8, L9, L10, L11, L12, L13. Now the code runs so fast can't even see the changes on form. But I disabled the code to run queries.
So what form and code have you been running that 'does nothing' because it sure does a lot for me - not a lot of good but a lot.
What is purpose of tblProgress? Why is form bound to this table?
When you turn off warnings at beginning of a procedure, should turn them back on at end. If you use CurrentDb.Execute then don't have to bother with SetWarnings.
Let me know if you still need help after cleaning up code.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I think Im done with this I think I will just look at it another day I guess.
Okay I am back sorry I just want to figure this out now I have done it a different way this time and need someone to analyze this code for me.
Private Sub Command712_DblClick(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Dim lngTotalRecord As Long
Dim lngRecord As Long
Dim x
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM trnrritem")
If rs.RecordCount & gt; 0 Then
DoCmd.OpenForm "sysStatusBar"
rs.MoveFirst
lngTotalRecord = 1
Do Until rs.EOF
rs.MoveNext
lngTotalRecord = lngTotalRecord + 1
Loop
rs.MoveFirst
lngRecord = 1
Do Until rs.EOF
updateWarehouseInventory rs!itemID, intWarehouseId, strBatchNumber, rs!BaseUnitCost
Forms!sysStatusBar!percentage = Trim(Str(Int((lngRecord / lngTotalRecord) * 100))) & "% Complete"
Forms!sysStatusBar!Box2.Width = Int(Forms!sysStatusBar!box1.Width * (lngRecord / lngTotalRecord))
Forms!sysStatusBar.Repaint
rs.MoveNext
lngRecord = lngRecord + 1
x = DoEvents
Loop
DoCmd.Close acForm, "sysStatusBar"
End If
db.Close
Set db = Nothing
End Sub
When Running this code I get syntax errors, as shown in red.
And if there is a cleaner way to set the code up please allow me to accept that code.
What is supposed to be in place of >? Maybe:
If rs.RecordCount <> 0 Then
Why do you loop through recordset and do nothing with any fields? Maybe just do:
lngTotalRecord = rs.RecordCount
Why bother with Str() and Trim() functions?
I presume & should just be &.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I found this code at
http://hgminerva.wordpress.com/2011/...s-application/
Can you rewrite the code and send it to me and I will try it???
I have thought about it and I think I have got a better way to do it but I just wish I could figure this out okay I kind of tried to think about an If Then statement but I need someone that knows the code to write it for me I have this currently as my status bar. . .
It consists Of two boxes one for the background and the other for the status both their names are box1 and box2
I also have a text box in the center that is unbound and currently this is just a form but hopefully with your assistance my idea could unwrap itself
My idea:
Button On Click Command
If status (txt box) says "Status: 0%"
Then box2.width = 0
end If
box2.width + 1
If box2.width = 1
Then status (txt box) says "Status: 10%"
end If
box.width + 1
If box2.width = 2
Then status says "Status: 20%"
. . . . . . .
And so on until
If box2.width = 2
Then Cmd.Close <------Close Form
End Sub
Your latest version doesn't make sense.
Did you try the edits I suggested for the looping code?
Why didn't you stick with the original code I reviewed in post 18. It does work with the edits I described.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I have tried both the suggestions and neither of them work for me sorry
I can assure you that this one seems way easier to me Look at this Post here. . . . . .
http://hgminerva.wordpress.com/2011/...s-application/
That is where I got the easier version but I still don't understand how I could build the second part of the coding he provided can you use this updated download of my database and try it and send me the code?
DLDB.zip
the form is called frmProgress
I still get the 64-bit error when opening db.
Did you run Debug>Compile on your code? I did and it errors in several places - 'Method or data member not found'. This is really annoying during debug efforts. I quit your db and did a little test in one of my own with the following which works great.
Code:Private Sub Form_Load() Me.Box1.Width = 5200 Me.Box2.Width = 0 Me.Percentage = "0% Complete" ProgressBar End Sub Public Sub ProgressBar() Dim lngTotalRecord As Long Dim lngRecord As Long Dim x lngTotalRecord = 10 lngRecord = 1 For i = 1 To lngTotalRecord Start = Timer While Timer < Start + 1 DoEvents Wend Me.Percentage = Trim(Str(Int((lngRecord / lngTotalRecord) * 100))) & "% Complete" Me.Box2.Width = Int(Me.Box1.Width * (lngRecord / lngTotalRecord)) Me.Repaint lngRecord = lngRecord + 1 Next End Sub
Last edited by June7; 07-02-2014 at 11:40 PM.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Did you put all this code under the Form_Load?
what all did you have to make just the form and a table or just form with code inside?
This is what I have come up with and now All it does is when I hit the button to open the form then all I get is a belay then it opens but shows 100% Complete and you couldn't see that it goes from 10% to 100% . . . .
Code:Private Sub Command714_Click() DoCmd.OpenForm "sysStatusBar", acNormal 'DoCmd.RefreshRecord End SubCode:Private Sub Form_Load() box1.Width = 5200 Box2.Width = 0 percentage = "0% Complete" sysStatusBar End Sub Public Sub sysStatusBar() Dim lngTotalRecord As Long Dim lngRecord As Long Dim x lngTotalRecord = 10 lngRecord = 1 For i = 1 To lngTotalRecord Start = Timer While Timer < Start + 1 DoEvents Wend Me.percentage = Trim(Str(Int((lngRecord / lngTotalRecord) * 100))) & "% Complete" Me.Box2.Width = Int(Me.box1.Width * (lngRecord / lngTotalRecord)) Me.Repaint lngRecord = lngRecord + 1 Next End Sub
![]()
I have the timer code in there so I can see the progress bar change. I used this because I didn't want to create code that really does something, like run queries. It works for me. Try a higher number.
Start + 10
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.