473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Tracking if the task is closed and then allow user to open new task

Hi All,

Thank you so much for helping me till now in solving so many issues.

-------

My application is almost done, just one thing which I find challenging (or may be am not able to figure out the proper logic for it).

Before heading to the question , I would like to give the overview.

There are 2 forms:
1) Form1
2) Tasks

On "Form1" their is a button which open form "Tasks".

On form "Tasks" the logged in user can save the starting and ending time.
While it is not always mandatory to save the ending time.

All these details are stored in Table : "TasksD"
Fields are like :
ID(Autonu)
EmpId(Numeric)
start(text)
end(text)
Duration(Text)

Now, when the user saves the end time, the difference between the start and end time is been calculated and captured in Duration field.

What I really want to achieve is:

Until the user has saved the end time of the previous task, he/she cant open the form "Tasks".

I tried implementing some logics but they are not serving the requirement.

All the suggestions are accepted. :)
Jun 3 '15 #1
17 1603
Seth Schrock
2,965 Expert 2GB
How would they enter the End time if they can't open the Tasks form? One way would be to count how many records they have that don't have an End value. If that number is greater than 0, then don't open the form.
Jun 3 '15 #2
Thanks Seth for replying :)

Answer to your question.

If the user has saved only the start time , then the end time can be saved.

I have a report which have the particular column (which works like a hyperlink) which redirects to that particular task and allow the user to save the end time.

What I really want is bound the user to save the end time first and than only start new task.

I tried using a variable to check the table for the "duration" column, if it is Null than don't allow otherwise allow to start new task.

But it turned out flop.

Your suggestion sounds good, can you please highlight it little more.
Jun 3 '15 #3
Seth Schrock
2,965 Expert 2GB
You mentioned having a button on Form1 that opens the Tasks form. In that button's OnClick event, have an If-Then-Else statement that uses the DCount() function to check if there are any records that don't have the End value set. Something like this:
Expand|Select|Wrap|Line Numbers
  1. If DCount("*", "TasksD", "End Is Null") > 0 Then
  2.     MsgBox "You can't add another task because you haven't finished the last one."
  3. Else
  4.     DoCmd.OpenForm "Tasks"
  5. End If
Jun 3 '15 #4
Hi Seth,

I tried implementing it.

but it is not working. It is not even doing anything.

I would like to know how will it figure out that if the end value is null field.

See what I mean to say is:
As I mentioned earlier, there is a field "EmployeeId". So the values are saved according to the logged in employeeId.

So, there will be duplicate employee id right.

Just want to understand the logic well.
Jun 3 '15 #5
Seth Schrock
2,965 Expert 2GB
So you would need to add the EmployeeID to the criteria of the DCount() function (the third parameter).
Expand|Select|Wrap|Line Numbers
  1. DCount("*", "TasksD", "End Is Null And EmployeeID = " & SomeVariable)
You would replace SomeVariable with whatever you are using to store the currently logged in user ID.
Jun 3 '15 #6
Hi Seth,

I am using an unbound control to fetch the current user.

I replaced my previous line with this line.

Expand|Select|Wrap|Line Numbers
  1. DCount("*", "TasksD", "End Is Null And EmployeeId = " & Me.txtUserID) > 0
Note: EmployeeId is numeric field.

But still it is not working.

I tried placing new button to my form and placed this code under on click event , but it is not doing anything.

Neither of the things.
Jun 3 '15 #7
Seth Schrock
2,965 Expert 2GB
Do you get an error or what happens when "it doesn't work"?
Jun 3 '15 #8
No Seth.

I am not getting any kind of errors.

But it seems the button is not working.

It only blinks as I click on it. and it does nothing
Jun 4 '15 #9
Seth Schrock
2,965 Expert 2GB
If you go into design view and look at the events for the button, is there anything listed for the OnClick event? If so, click on the ellipsis button (three dots) and make sure that it takes you to your code. Then put a break point on the If-Then line and then click the button and us the F8 key to step through your code to see what is happening.
Jun 4 '15 #10
Hi Seth,

Even though, I am inserting break points and clicking the button.

It is not allowing me to debug. As I usually check using break points , but this is not even going to it. It only blinks and does nothing.
Jun 4 '15 #11
Seth Schrock
2,965 Expert 2GB
Did you verify that the button's OnClick event is pointing to your code? This happens occasionally where a control will lose its mapping to the code that it is supposed to run and it has to be recreated.
Jun 4 '15 #12
Yes it is pointing to my code only.
Jun 4 '15 #13
Seth Schrock
2,965 Expert 2GB
Try closing out of the database, getting back in and see if you get a message asking to enable code.

Before you do that, go into Access Options > Trust Center and then select the Message Bar tab on the side. Make sure that the Show the Message Bar... option is selected.
Jun 4 '15 #14
Ohk. I did what you suggested.

But no change.

Instead I would like to know if I can use the same code on some other event?

As the code which you provided , I am using under new button.

As , the actual command button already have Embedded macro under Onclick event.

so, if it works, can we put the code under some other event.

Just in case it helps. Atleast actual button opens the form
Jun 4 '15 #15
Seth Schrock
2,965 Expert 2GB
So you created a new button to test the code and it isn't working in its OnClick event. You can try it in the button's GotFocus event.
Jun 4 '15 #16
Hi Seth,

I tried on GotFocus event, its not working either.
Jun 4 '15 #17
Seth Schrock
2,965 Expert 2GB
I don't know what to tell you. Try deleting your control and then recreating it and add the On Click event and see if it runs.
Jun 4 '15 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Renie83 | last post by:
Hi I really am going crazy! I'm using VBScript, ASP, and SQL My page reminds me of a shopping cart but looking at shopping cart examples has not helped! What I have is a page that brings in...
2
by: David Olive | last post by:
Hi guys, I'm having a bit of a problem getting a VB .NET console app to run happily as a scheduled task. The app itself generates a bunch of word documents on a file share on another server by...
0
by: mano kumar | last post by:
hello, is there a way i can control what user upload to the webserver? i've created a upload feature and i dont know howto control what the user uploads. i want to allow my user to only upload...
6
by: jeet_sen | last post by:
Hi, I have generated a table and have attached a pop up to display at onmouseover event of each cell. For each cell the pop up will display cell specific detailed data. I have generated the pop...
2
by: Marc | last post by:
Hi, I want to allow the user to rename a button control. When they click rename from the menu I want the button text to become editable on the actaul button...and then perhaps save the new text...
2
by: pats2kdynasty | last post by:
I have a bunch up lookup tables that I want to allow the user to edit. I am trying to accomplish this via one form with a drop-down list of the lookup tables. When the user selects a table the...
1
by: skinymike | last post by:
when i allow user to download a media file such as midi or wav files. It automatically open the files using Windows Media Player. Its fine works ok. But when i allow user to download a theme files...
5
freddieMaize
by: freddieMaize | last post by:
Hi Guys, I run a lot of task in my system. Every day i shut down the system.. Which means, when i come the next day i have got to start all the task again which consumes a lot of time.. I know...
5
by: MyWaterloo | last post by:
What is the best method to allow the end user to be able to add a field? Is there anyway to have a button or something on the form that would allow the user to create a new field without the user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.