HELP Newbie please! IIf statement not working, SELECT case instead?

No that is the point... You have a combobox (right?) that lists the table's contents as in the Options you have in your case....

If so... Then adding in the "dueindays" column to your combobox query, then adding the hidden column to "column widths" by adding ";0" to that (but you can do that later on)

Then Me.Comboboxname.Columns(1) will retrieve your dueindays value which is in the table. So the calculation does nothing with case or anything, it simply says
" Somedate + Me.Comboboxname.Columns(1) "
Or something simular....
 
Hmmmm.that is interesting.
Actually, I had already set the combo box like that, with the column hidden.
That me.combobox thing goes in the vb section for which form?
Would it be the main form, "input facility task reviewer" or the "Task_subform" or the "Review_subform"? Thanks.
 
Hmmmm.that is interesting.
Actually, I had already set the combo box like that, with the column hidden.
That me.combobox thing goes in the vb section for which form?
Would it be the main form, "input facility task reviewer" or the "Task_subform" or the "Review_subform"? Thanks.

Me referes to the current form, if you want the value to be used in a subform... you will have to use Me.Parent

Regardless, you should use the reference where you need it... Only you know that and I cannot tell you that...
 
namliam, Thanks again for your most recent reply.

What if the field I'm using it in is on a subform and the combo box I'm calling from is also on a different subform, both on the same main form.

I.E.
Main form = Input Facility Task Reviewer
Subform 1 = Task_Subform (where cboTaskType is located with 2 columns)

Subform 2 = Review_Subform (where DATEREVIEWDUE textbox is and also where DATEREVIEWASSIGNED textbox is)
 
Last edited:
Also, this kind of goes back to the original issue I thought I was having. Should this go on the Review_subform and can the Review_subform "see" items in the "Task_Subform".
When you open VB to put in the code, you know how VB sometimes autofills and gives a drop down for you to choose your most logical next choice.
When you are doing this under a sub on Review_subform, none of hte fields on the Task_subform show up in the auto populate list.
I know this should be able to be fixed by making it a Public sub, but I'm still not sure how to set it up.

I tried this, which of course, didn't work...

BTW, it's on the Review_subform

Public sub
[DATEREVIEWDUE] = Me.Parent.cboTASKTYPE.Column(1) + [DATEREVIEWASSIGNED]
End Sub

I also tried it without the .parent in there too.

I feel we've got to be very close, but it continues to frustrate as we get closer:confused:
 
If you have a "brother" subform where you need to fetch the information from.... oh brother...

Try it from the main form first... that goes something like: Me.SubformName.combobox.columns, I think... from memory

Then from the subform you first have to go up Me.Parent, then go down...
Me.Parent.Subformname.combobox.columns, I think or something simular ... from memory...
 
I'll give my points to namliam as he helped me the most during this.

I ended up using a Public Function with the select case statement but moved it outside of the module it was originally in.

Someone else suggested I do this.
I had to tweak the controls on the form a bit, making them bound and adding to their AfterUpdate procedures.

It all worked out in the end and I thank you for all of your help.
 
I thought I had closed out this thread, but apparently not. I awarded points to namliam. Anyway, I got this all working from the perspective of a select case statement. I have another question.
I've tried several ways to get it done but I keep ending up with errors.
I've added to the DATEREVIEWASSIGNED After_update procedure and I also have it in the property for the default value.
I realize at this point I probably shoudn't have it in both places, but I was just basically testing to see what happens in all instances.
I want the DATEREVIEWASSIGNED to be populated with today's date to start, but the initial entry user should be able to change it.
Don't pay any attention to the background formatting, I was testing what different controls do there.
I'm getting the date of 12/31/1899 in the date field now, which from what i've researched is equivalent of 0 in Access.
I can get the two date fields to greyout(disable) once you move to the next record, but it still allows you to change the date in the next record, which you shouldn't be able to do.
I'm attaching an up to date copy of the database so you can see exactly what happens when you open the Input Facility task reviewer form. Thanks. Can someone take a look at my sample I've uploaded and tell me how to fix this problem with my DATEREVIEWASSIGNED and DATEREVIEWDUE? I try posting this in a new forum too...
 

Attachments

Users who are viewing this thread

Back
Top Bottom