Solved: Need code help in access

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

jmk909er

Thread Starter
Joined
May 20, 2009
Messages
354
Need code help in access

In laymans terms I need to do something like this for multiple comments:


Private Sub Form_Load()
If MGR_Comments is not null (or is populated) Then LabelMgr will = visable
And IF ENG_Comments is not null (or is populated) Then LabelEng will = visable
And If ENV_Comments is not null (or is populated) Then LabelEnv will = visable
End If
End Sub

This is for indicating if comments have been made on a summary form, the label will become visable and say "Manager" for example. I have the labels property for "Visable" set to "No". I don't know if this is the right way to do this or not???

Thanks, Joe
 

calvin-c

Banned
Joined
May 17, 2006
Messages
1,098
Assuming these are separate labels that don't overlap then it should work if you remove the And.

If MGR_Comments is not null then LabelMgr.Visible=True
If ENG_Comments is not null then LabelEng.Visible=True

If these are separate labels that overlap then you need to decide how you'll handle it when there's more than one comment. Assuming you'll display them in order (i.e. if manager comment then you'll show that, otherwise you'll show engineer comment) then you'd code it with either Else or maybe using a Select Case. Select Case executes the *first* case that's satisified, not every case that's satisfied so it would work, but I don't personally think it's as clear as the If/Else when multiple tests are met.

If MGR_Comments is not null then LabelMgr.Visible = True
Else If Eng_Comments is not null then LabelEng.Visible = True
End If
 

jmk909er

Thread Starter
Joined
May 20, 2009
Messages
354
Hey OBP I am struggling with this:

In frmNNFList there is a line that starts "Comments Made By:" I want the labels to appaer only when the frmNewNonFunded comments sections are populated. I kinda have it working but it is not being applied properly to each record set??

It might be a simple fix but I don't get it.
Thanks, Joe
 

Attachments

OBP

Joined
Mar 8, 2005
Messages
19,895
Joe, I have added & tested the code for the Managers Comment. However the fields do not appear until afetr you have entered the data and moved to the next field, which means that you have to go back to the sign field, so \I have added a set focus to the code as well.
 

Attachments

jmk909er

Thread Starter
Joined
May 20, 2009
Messages
354
Hey OBP, this is a great feature and I will use it, however when the comment is populated I want it to make visable the "Manager" label (for instance) on the frnNNFList because this will be a summary form of all the records so that management can quickly and easily see that a comment has been made by a manager, engineer, etc. The code I have for it "OnLoad" sort of works but is not applying it individually per record. For instance one record might have 2 labels visable, another 4 labels visable depending on how many comments have been entered per record.

Also this feature you have made to make the other fields visable on the frmNewNonFunded I will need them to self populate with the "Environ" and the current date.

I hope I have explained this well??

Thanks, Joe
 

jmk909er

Thread Starter
Joined
May 20, 2009
Messages
354
I think that what I am trying to do is not possible because the "comment by" labels on frmNNFList are not bound to any specific record-is that correct???
 

OBP

Joined
Mar 8, 2005
Messages
19,895
The Me.LabelEnv.Visible and Me.LabelPC.Visible are working on the version that you sent me.
But the code should be in the On Current event to be refrshed for each record.
 

jmk909er

Thread Starter
Joined
May 20, 2009
Messages
354
I moved it to "On Current" but it is still not working properly it is only picking up data from record #1.
If you look at record 2 it has 5 comments, record 3 has 1 comment. Record 1 has 3 comments in Manager, Environmental, and Prod Controller and those 3 are the visable labels in frmNNFList.

Is it because those labels in frmNNFList are not bound to the records? Maybe I can instead add the comment field with label to the frmNNFList, hide the text box and just use the label associated with that control??
 

jmk909er

Thread Starter
Joined
May 20, 2009
Messages
354
I just made a new record #4 and now the only visable label on frmNNFList is is showing on all 4 records for for record 4

I think I am in over my head!
 

jmk909er

Thread Starter
Joined
May 20, 2009
Messages
354
I think I need to back up and start over with this;
Is there a simple way to indicate on frmNNFList that a comment has been made in the 5 comment catgories without actually showing the comment? What I have been trying has failed and if I can get a label to =visable it is global instead of applying to each record individually.

This form is a summary of all the records and I just want a quick way to see if a comment has been made and by what department for each record.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
If you add the comment fields to the form you can make the field too small to show the data, but still show the field's labels.
 

jmk909er

Thread Starter
Joined
May 20, 2009
Messages
354
Hey OBP, here is what I came up with and it seems to be working OK. One thing that I don't know how to do is link 2 forms, maybe you can show me?

On frmNNFList I want to be able to click on the WONUM field and open frmNewNonFunded so that it opens the corresponding record.

I am working on my 2010 microsoft at home but I think it still saved it in 2002-2003 format

Thanks, Joe
 

Attachments

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top