Command Button?

CunnyLis77

New member
Local time
Yesterday, 16:33
Joined
Apr 18, 2005
Messages
8
I, unfortunately, have been singled out as the Access guru in my work area. We have 223 people and the Information Manager has tasked me to modify a database he "found" to be able to track a number of things, but most important to him: performance reports.

I have posted the sample of what I currently have. What is being asked of me is a way in which to have a button or by double-clicking a block where a date would go for all other dates on the form to become non-visible while the current date stored in the computer the database is being worked from be entered in the block where the button or double-click happened. All this links to a report for the IM to be able to track what performace reports are out, and when they are due back to his section. He also wants me to be able to show which are overdue and where they are at. I am not sure if it is at all possible, but with me having spend most of last week purusing the articles on Access here, I know now that nothing is implausible if you happen to go about it the right way.

Since I have read the rules on posting, here is what I have done. I searched the forum for command button and got a lot of really cool ideas to use elsewhere in the database. I looked up the help in the program itself for command button, and got some good information on how a command button works, but I cannot make it put a date into a block. I can enter the date in any block that is a date format, but then I have dates in every block. He only wants to see the most current date in any of the blocks.

Any assistance at this point would be appreciated. If I have missed something in another thread, I apologise in advance.
 

Attachments

just to make sure i follow....Only 1 date field will have a date at any given time.
Once the date is entered into a field, all other fields then become hidden.
If this is the case you can try something like this I think:

In the fields afterupdate event place the following code:

Private Sub quoted_AfterUpdate()
If Me.DateField1 = True Then
Me.DateField2.Visible = False
Me.DateField3.Visible = False
Me.DateField4.Visible = False
Else
Me.DateField2.Visible = True
Me.DateField3.Visible = True
Me.DateField4.Visible = True
End If
End Sub

Do this for each of your fields. When a date is entered in a field all others should become blank. You may also need to place the code in the FORMS_CURRENTEVENT as well.

Kevin

edited to reverse true and false...
 
Last edited:
Explanation

Yes, I do mean that while the form is on screen only the place where the report is and the date is was sent should show. I looked at your code, and if I am reading it right, I would need to change it to match what field the information is in. i.e. one date field is Date to IM, so instead of

me.datefield1

I would use

me.Date to IM

Or am I missing something? I will try the code you sent as is. I thought maybe an on click command to put the date in would be good. Suggestions?
 
yes, substitute your field names for "Datafield1" and so on. To save your self some typeing, just do it for 2 or 3 fields first, to get it working, then add the other fields once it works the way you want it.

I would suggest you get this working then go the extra step and use a calendar control to enter dates into the fields, but get what you NEED done first.

HTH
 
tried-not worked

krberube said:
yes, substitute your field names for "Datafield1" and so on. To save your self some typeing, just do it for 2 or 3 fields first, to get it working, then add the other fields once it works the way you want it.

HTH

When I tried to enter the code in the properties area of the form design, it gave me a illegal syntax error. I then went to the arrow on the right where you can select what you want it to do, and selected [event procedure] and hit the builder then copied the code (with mods) and it is not working. perhaps I am doing it wrong? I will continue trying to get it to work.

thanks for your time and help so far.
 
1 - properties of the first date field.
2 - Event Tab
3 - AfterUpdate event procedure. In the code window copy the below code, substituting your field names for 2, 3, and 4. this will be inbetween the "PRIVATE SUB" and "END SUB"

If Me.DateField1 = True Then
Me.DateField2.Visible = False
Me.DateField3.Visible = False
Me.DateField4.Visible = False
Else
Me.DateField2.Visible = True
Me.DateField3.Visible = True
Me.DateField4.Visible = True
End If


4 - Then copy what you typed into the "FORMS ON_CURRENT EVENT".
Save and open your form. Enter a date in your first date field. when you tab out of that field the other 3 field should hide.

Am leaving for the day, be back tomorrow am.
 
Look at the version oy your DB I am posting. I used the ISNULL for determining the field has data or not. You can then add this to each one of your fields. If field 2 is null then......
If field 3 is null then....
There might be a better way of doing it, but this is what i have done in the past. I enter a date in your first record so you can see how the from looks.
 

Attachments

Many Thanks

krberube said:
Look at the version oy your DB I am posting. I used the ISNULL for determining the field has data or not. You can then add this to each one of your fields. If field 2 is null then......
If field 3 is null then....
There might be a better way of doing it, but this is what i have done in the past. I enter a date in your first record so you can see how the from looks.

Thank you. The dates still have to be put in manually, but when the next step in the process is completed, then the date already there would just be erased, and the data entry person just tabs to the next field, and everything is great.

Again, thank you.
 
Took awhile but...

It seems to be working. The only question I know have is how to update the
form on current for each individual block... Below shows it for Shell to Rater...

Private Sub Form_Current()
If IsNull([Shell to Rater (10)]) Then
Me.Section_Date__3_.Visible = True
Me.Return_to_Rater__1_.Visible = True
Me.Cheif___OIC_Date__2_.Visible = True
Me.Flight_Admin.Visible = True
Me.Tech_Admin.Visible = True
Me.Awaiting_Sig.Visible = True
Me.Final_to_OR.Visible = True
Me.MPF.Visible = True
Else
Me.Section_Date__3_.Visible = False
Me.Return_to_Rater__1_.Visible = False
Me.Cheif___OIC_Date__2_.Visible = False
Me.Flight_Admin.Visible = False
Me.Tech_Admin.Visible = False
Me.Awaiting_Sig.Visible = False
Me.Final_to_OR.Visible = False
Me.MPF.Visible = False
End If
End Sub

When I update for Section Date (3) do I need to up date the on current for the form? I am sorry if this seems like a stupid question, but I am only working on one record now, but there could be as many as 500 records at once working here eventually.

Thanks,
Dr
 
If I understand the question correctly, yes, you have to copy the code from each fields afterupdate_event into the forms Current_event. Its alot of copying and pasteing but it will work. I only do it for 3 different fields so it wasn't as bad for me, you have 8 fields.
 
Thank you

After a couple of hours of typeing and then cutting and pasting (I did not think about putting it in word and then changing only the one block at a time until I had done 4 events typing the whole thing in...) I got it to work. I wanted to say thank you for your patience and assistance.
 

Users who are viewing this thread

Back
Top Bottom