Forum Discussion
query
stephantmi54 Hello
Can you give some info on how exactly your application hangs ?
I opened it and it seems "fine" although i didn't examined its functionality
From a quick glance nothing out of ordinary except a little too much code which i am unsure how you use...its not clear at first look
Your references looks good so no problem on this...after all everything is handled by macros (a lot)
It hangs when in invoicing you click the drop down to select a vendor... the app hangs and crashes... I can create a project, add vendors, add PO's but when attempting to add an invoice, a crash... again only on my desktop. On my old notebook it works fine...
I did check and found that the desktop is Windows home, version 2004 and the notebook is windows pro version 1909... The desktop is a new Alienware Ryzen 10, the notebook a older Surface Pro 4.
- Jun 26, 2020
Do you have any events on that combo box? Please show us the code? Perhaps try a different approach.
Have you tried a Decompile/Compact and Repair/Compile/Compact and Repair?
Have you tried creating a new blank database and importing everything, then compiling to ensure there are no issues? - tsgiannisJun 26, 2020Iron Contributor
stephantmi54 i think i saw it
With Rec3
For i = 0 To Rec.RecordCount - 1
.AddNew
Rec3.Fields("ID") = Rec.Fields("ID")
Rec3.Fields("Amount") = Rec!Amount
Rec3!Remaining = Rec!Amount - Rec!Invoiced
Rec3.Fields("Vendor") = Rec!Vendor
Rec3!Description = Rec!Description
Rec3!ID = Rec!ID
Rec3!Original = 1
Rec.MoveNextNext i
.UpdateEnd With
The problem for start is that Rec recordset is empty to begin....you have criteria which you don't supply values so it bombs out
Also .Update should be inside the loop not outside...at least to my knowledge (never used it otherwise)
Adding a simple if .Recordcount>0 then would resolve it
With Rec3
If .RecordCount>0 then
For i = 0 To Rec.RecordCount - 1
.AddNew
Rec3.Fields("ID") = Rec.Fields("ID")
Rec3.Fields("Amount") = Rec!Amount
Rec3!Remaining = Rec!Amount - Rec!Invoiced
Rec3.Fields("Vendor") = Rec!Vendor
Rec3!Description = Rec!Description
Rec3!ID = Rec!ID
Rec3!Original = 1
Rec.MoveNextNext i
.UpdateEnd if
End With
P.S. if someone can tip the admins of this Community that "Insert/Edit Code Sample" is not working would be much obliged
- stephantmi54Jun 28, 2020Copper Contributor
I tried this plus other ideas and I still fail selecting the vendor in the invoicing screen. It must be a bug in my desktop windows or Access… it runs on all other PCs that I’m aware of… did you get the same crash or did it pull up a vendor in the invoicing screen?
- tsgiannisJun 29, 2020Iron Contributor
I didn't had any issues after the "fix"...no i didn't had crashes in the first place...you should open the application bypassing the executing code (SHIFT) and run the forms...if an error is popped just do what is needed to fix it