Checkbox question

mystery45

Registered User.
Local time
Today, 08:23
Joined
Mar 31, 2008
Messages
14
yes i have been trying to solve this issue for a while. I can't find the solution. here is the issue.

I have a main form. The primary key is a tracking number. When this number is entered it fills in both the day and date fields on the spreadsheet.

I have several subforms. Different processes run during different days. IE process 2 has 2 reports that only run on tuesday and friday. If it is not tuesday or friday i want these check boxes to be disabled.

This is the code I have for the sub form in the On Current block.
however when the date on the main form reads Sunday the check box is still active and i can still click on it. i want this to be disabled. if i can get this down i can modify it for the other reports as well. However i have been unable to do so. This is very aggravating and i don't know why it is not disabling itself.

Spare_Processing (Main Form)
Day (well the day of the week)
Mega_Form (sub form)
win_load (checkbox).

Private Sub Mega_Form_OnCurrent()
If Me![Spare_Processing]![Day] = "Tuesday" Or Me![Spare_Processing]![Day] = "Friday" Then
Me!Mega_Form.Form!win_load.Enabled = True
Else
Me!Mega_Form.Form!win_load.Enabled = False
End If
End Sub
 
Obviously you are referring to the wrong thing because if you have this current event:
Private Sub Mega_Form_OnCurrent()

and you are trying to use:
Me!Mega_Form.Form!win_load.Enabled = True

Me in this context refers to Mega_Form so you don't refer to it as well. In this case, since the code is ON the subform, you just use

Me.win_load.Enabled = True
 
Thanks for your quick response but like everything else I have tried the same thing happens.
The box is still enabled and I can still click on it. Check and Uncheck it.

I don't understand why it isn't greyed out and disabled.
would it be better to try .visable instead of .Enabled?

it is like access isn't even seeing the coding on the sub form.

Do i need anything in the main form?
 
Last edited:
If it is remaining enabled then your part:
If Me![Spare_Processing]![Day] = "Tuesday" Or Me![Spare_Processing]![Day] = "Friday" Then
must not be returning the value you think it is. Try putting a message box in like:

MsgBox Me![Spare_Processing]![Day]

so you can see what the value actually is.
 
My question is, what exactly is

Private Sub Mega_Form_OnCurrent()

supposed to be? To the best of my knowledge, the OnCurrent event for any form is

Private Sub Form_OnCurrent()

regardless of the name of the form!

Private Sub Mega_Form_OnCurrent()

is not going to fire when the user moves from one record to another on the Mega form.

Or is this something new with 2007?

Linq
 
My question is, what exactly is

Private Sub Mega_Form_OnCurrent()

supposed to be? To the best of my knowledge, the OnCurrent event for any form is

Private Sub Form_OnCurrent()

regardless of the name of the form!

Private Sub Mega_Form_OnCurrent()

is not going to fire when the user moves from one record to another on the Mega form.

Or is this something new with 2007?

Linq

Nope, you got it correct. I missed spotting that one.
 
Sorry i am just trying anything. NO matter what code I put in access seems to just ignore it and go on about its business.

I can still check and uncheck the win_load check box. This is very aggravating.

I changed it to form_OnCurrent

Still doesn't work.

Is there something I need in the Main Form so that it goes straight to that procedure?

current code on subform

Private Sub Form_OnCurrent()
If Me![Spare_Processing]![Day] = "Tuesday" Or Me![Spare_Processing]![Day] = "Friday" Then
Me.win_load.Enabled = True
Else
Me.win_load.Enabled = False
End If

I am not really a programmer Nor a DBA this is just a project I decided to do for work. It has been a while hence all the questions.
 
Sorry i am just trying anything. NO matter what code I put in access seems to just ignore it and go on about its business.
that's why I suggested the message box, but in light of the problem where you didn't have the event correct that would explain a lot.

I changed it to form_OnCurrent
You should NOT be changing it yourself. You SHOULD have selected it from the drop down in the VBA window, or clicked on the ellipsis from the form's properties dialog. Access doesn't like it when you try typing them in manually.
I am not really a programmer Nor a DBA this is just a project I decided to do for work. It has been a while hence all the questions.[/QUOTE]

You may have to create a blank mdb file and import everything into it as you've likely honked up the events and it isn't going to act too well for you by trying to type in your own events. I've found that it sometimes requires a whole new db to recover from that.
 
Ok i rebuilt the whole thing and imported in it.

i then selected the on current from the forms properties for some reason it showed up current instead of on current.

when that happens it doesn't like the if statement I get an error saying that it can't find the field "spare processing" but spare processing is the name of the main form not the field.

(now i know why i got out of programming).

i don't understand why it is so difficult to disable a stupid check box.
 
ok here is it try these cdc date (primary key)

7384 Sunday (should be disabled)
7385 Monday (should be disabled)
7386 Tuesday (enabled)

If i can just get this one box to work i can replicate the same thing for the others that i need.

you can access everything through the Spare Processing Form.

It will be labeled mega and a command button beside of it.
 

Attachments

Okay - the immediate need:

You aren't dealing with a subform, but the day is not on the mega form either so you have to refer to the form it is on:
Code:
If Forms![Spare_Processing]![Day] = "Tuesday" Or Forms![Spare_Processing]![Day] = "Friday" Then
   Me.win_load.Enabled = True
Else
   Me.win_load.Enabled = False
End If

The bad news --

You REALLY need some learning in Normalization. This database is nowhere near normalized and will only cause you pain and suffering as you try to pull meaningful data. This is definitely designed in a spreadsheet way rather than a relational database way. So, you are not taking advantage of the benefits of a relational database and that will make it very difficult on you as you go to get the data out. Yes, it will be easy to store the data, but will be very hard to get it back out.

See here for more on normalization:
http://support.microsoft.com/kb/283878

and work through these tutorials:
http://www.functionx.com/access/index.htm
 
Thanks so much for your help I greatly appreciate it. OMG been working on this issue for like 3 days.

Really this is going to be used for daily processing of tasks. Someone made a spreadsheet but i figured it would be easier to make a database to keep track of everything. Plus it is neater, and a spreadsheet can't do what they really want it to do but this can.

The problem is most of the data is un related in certain ways. I mean each form as its own reports that have to be tracked and ran.

It has been 10 years or so since I touch access this much in depth. If anything is wrong people are going to want to pull the whole CDC and check everything.

If someone needs to check something they are going to pull the whole CDC date and look at it. Or they will look at just 1 Process.

I will look through the links though and see if there is anyway i can clean it up a little although I am not sure I can. Each procedure has to be tracked and accounted for. (I work in a pretty strict business) if not and something happens then we are held liable from our customers and get fined for it.

I will check out the links you sent me, and if you have any other advice i would welcome it as well.
i am also getting help from our DBA at work. so he might be able to help me clean it up a lot better.
 
Last edited:
The problem is most of the data is un related in certain ways. I mean each form as its own reports that have to be tracked and ran.
From what I see, it isn't unrelated as you have many of the same fields and repeating fields are not normalized. As for each having it's own information to be tracked and reported on, it actually is much EASIER to track it if it is being stored normalized.

If anything is wrong people are going to want to pull the whole CDC and check everything.
not a problem with a normalized database

If someone needs to check something they are going to pull the whole CDC date and look at it. Or they will look at just 1 Process.
Not a problem with a normalized database and you can even create reports across processes so you could do things such as determine what the percent of the processes ran correctly, etc.

I will look through the links though and see if there is anyway i can clean it up a little although I am not sure I can. Each procedure has to be tracked and accounted for. (I work in a pretty strict business) if not and something happens then we are held liable from our customers and get fined for it.
Actually, having it normalized would allow you to track accountability and report on it. I think you're going to find that the current design will be a bear to try to report on.

I will check out the links you sent me, and if you have any other advice i would welcome it as well.[/QUOTE]
 
Again thanks a lot for your help.
I will get with the DBA at work and see if he can't help me clean it up a bit.

I tried making a reports table to hold all the reports in however when you do that and make multple forms using those reports it activates the check mark for all of forms that use that table. that cannot happen.

Each report on each process has to be individually checked. I can't have 1 check mark checking reports on 4 different processes.

I will get with the DBA here and see if he can't help a little bit.

Thanks again.
 
Each report on each process has to be individually checked. I can't have 1 check mark checking reports on 4 different processes.
I didn't say that. Read the link on normalization and what I've been saying SHOULD become clear.
 

Users who are viewing this thread

Back
Top Bottom