Form controls update but then show #Name? when reopen

MediocreD

New member
Local time
Today, 17:04
Joined
Nov 9, 2024
Messages
11
I'm working on a db to track my poker playing. I have created a form to update my play live while I play but the dashboard with all the stats is causing me issues.

I have uploaded the actual file but i dont know if it can be viewed or not. Please let me know the best way to get my actual file to be viewed because I am not explaining things properly and I think I could use your help
 

Attachments

You will have to describe in detail the problem, where to look, and how to recreate. I see no #name on dashboard.
stats.PNG
 
accidentally hit submit, but the image above is what i see... I dont understand why it stopped working for me.
 
I opened the form directly. Are you coming there from another form or menu?
 
no if i delete the control source of the total profit box and save then reenter it. Then it works.

But if I close and reopen directly or indirectly it doesnt work any longer
 
I cannot recreate the problem. I will have to look in detail and see if there is something I can deduce. But it is like taking the car to mechanic and it starts fine.
 
If you cannot figure it out why it is hanging, I would not waste time and rewicker it. Using all those calculated controls is the hardest most time consuming way to make this. There is nothing wrong with what you did except it is hard to do, really hard to edit, and impossible to error check.

I do something like this where I create variables for values then assign them to controls. Having the variables then allows me to make additional equations from the variables to assign to other controls. Also you have to rename your controls to descriptive things.

Code:
Public Sub LoadValues()
  Dim TournamentsPlayed As Long
  Dim TotalBuyIns As Currency
  Dim HoursPlayed As Long
 
  TournamentsPlayed = Nz(DCount("MTT_Dt", "tbl_MTTs"), 0)
  Me.TournamentsPlayed = TournamentsPlayed ' renamed txt254
 
  TotalBuyIns = Nz(DSum("MTT_Total_Cost", "tbl_MTTs"), 0)
  Me.TotalBuyIns = TotalBuyIns
 
  HoursPlayed = Nz(DSum("[qry_time_played]![Tot_Time]", "qry_time_played"), 0) / 60
  Me.HoursPlayed = HoursPlayed
 
  .....
End Sub

Also you can even make it easier by doing a lot of the summations and counts in aggregate queries. You can do a lot of the calculations in queries than use dlookup to get the values. This is so much easier to error check because you can do it piece by piece and see the correct values in the queries. This approach is so much easier to edit because you are not chaining values from multiple calculated controls and all the code is visible in one place.
 
resolve Post#8 first before anything else.
goto VBA, on menu->Debug=>Compile.. and see the errors you have on the code.
 
Your code won't even compile because of errors. Although, even with errors, the form opens just fine.

Form frm_BR_Maint has code in its module that is totally unrelated.

Missing VBA reference:
Microsoft Office X.X Access database engine Object Library

Why do some modules not have "Option Compare Database" in header? This should be included by default when module is created.

All modules should have "Option Explicit" in header.
Unfortunately, Access does not do this by default. From the VB Editor > Tools > Options > Editor > check "Require variable declaration"
Will have to manually add to existing modules.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom