473,789 Members | 2,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a date field to db

25 New Member
Hi all!

My database allows all employees to enter their time and get a report at any time. The first screen has a calendar which is locked to the last day of the pay period and that date is the only one currently in place. The user selects his/her name from a dropdown, clicks the calendar, then "Next" to get to the time input screen. There are combo boxes to select the cost code, project, and company name. Separate boxes are available for the number of hours worked Sunday thru Saturday, and the employee can input their time for each day on separate lines, if they choose to. This allows them to have a separate line for regular time, vacation hours, hours worked in different projects, etc. Most of our employees are exempt, but the salaried ones are needing a mechanism to enter the date in each line for all of their hours. With this need in mind, I put in three combo boxes based on three tables: tblMonth, tblDay, and tblYear. Problem is, when I select January, as an example, from cboMonth, all of the available lines are populated with January. The same thing occurs with cboDay and cboYear. I really can't figure out where I have gone wrong and would appreciate any help.

Thanks in advance for whatever help anyone can render, and if you need to actually see the database, I will gladly send it.

Thanks!

Rio
Nov 7 '06 #1
27 2867
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi all!

My database allows all employees to enter their time and get a report at any time. The first screen has a calendar which is locked to the last day of the pay period and that date is the only one currently in place. The user selects his/her name from a dropdown, clicks the calendar, then "Next" to get to the time input screen. There are combo boxes to select the cost code, project, and company name. Separate boxes are available for the number of hours worked Sunday thru Saturday, and the employee can input their time for each day on separate lines, if they choose to. This allows them to have a separate line for regular time, vacation hours, hours worked in different projects, etc. Most of our employees are exempt, but the salaried ones are needing a mechanism to enter the date in each line for all of their hours. With this need in mind, I put in three combo boxes based on three tables: tblMonth, tblDay, and tblYear. Problem is, when I select January, as an example, from cboMonth, all of the available lines are populated with January. The same thing occurs with cboDay and cboYear. I really can't figure out where I have gone wrong and would appreciate any help.

Thanks in advance for whatever help anyone can render, and if you need to actually see the database, I will gladly send it.

Thanks!

Rio
What event code are you using on the combo boxes? Can you post it.
Nov 7 '06 #2
Rio Liaden
25 New Member
I did not write code, merely built from wizard. Sorry.

Rio
Nov 8 '06 #3
NeoPa
32,579 Recognized Expert Moderator MVP
If you open the form in design view then select the controls (ComboBoxes; TextBoxes; etc) in order then look through the properties (There is a button on a toolbar or Alt-Enter should work equally well) look for any properties set to 'Event Procedure'. Where you find any, click on the elipsis box (little box with three '.'s (...)) on the right AFTER you select the property then copy the code found in that window.
Nov 8 '06 #4
Rio Liaden
25 New Member
Well, here it is, everything found in the editor...


Private Sub cboMonth_Before Update(Cancel As Integer)

End Sub

Private Sub Form_Load()
Me.Calendar1.Va lue = [Forms]![frmTimesheet]![Date1]
End Sub

'Private Sub Label27_Click()

'DoCmd.OpenRepo rt "rptTimesheetAA RDEXNew", acPreview, "qryTimesheetSi ngleScreen"
'End Sub

'Private Sub Label36_Click()
'DoCmd.Close
'End Sub

Private Sub Label48_Click()
On Error GoTo Err_Command49_C lick


DoCmd.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuIte m acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Command49_ Click:
Exit Sub

Err_Command49_C lick:
MsgBox Err.Description
Resume Exit_Command49_ Click
End Sub

Private Sub Project_BeforeU pdate(Cancel As Integer)

End Sub
Nov 8 '06 #5
MSeda
159 Recognized Expert New Member
Check the "Row Source" property for the combo boxes if this refers to your data table then it will show a list of records from the data table (i.e. if you have 15 january records january will be listed 15 times). If you used the wizard and selected the first option, on the first screen; "I want the combo box to lookup values in a table or Query" and then chose the table where you want the data to be stored that would have caused this to happen.

You need to either create a table called "months" and list the months and select this table when the wizard ask which table you want the values to come From, or select the second option on the first wizard screen. "I will type in the values I Want" and then list the months in the grid provided.

To save the value in the table make sure the "Control Source" for the form is set to the table you want to save your data in and the combos "control Source" property is set to tblMonth or whatever field you want to save to in the table.

It maky be easier to use a single date field instead of separtate Month, Day Year fields. With a Single date field you could use a calendar control for users to select the Date.
Nov 8 '06 #6
Rio Liaden
25 New Member
Strange things happened when I tried the aforementioned solution, so I'm trying another, more logical way. If I put a calendar (MSCAL.Calendar .7) on the sheet so that if the employee clicks on the date it will populate a field. What is the code to connect it to a text box? This is the solution that was suggested.

Rio
Nov 8 '06 #7
MSeda
159 Recognized Expert New Member
Place a command button on the form with the calendar control and put this in the buttons On Click Event procedure:

Private Sub Command3_Click( )

Me.Text1 = Me.Calendar0

End Sub

of course change the names to match your objects.
Nov 8 '06 #8
NeoPa
32,579 Recognized Expert Moderator MVP
Or you could put the same code in the AfterUpdate event of the calendar control perhaps, and save on the extra command button?
Nov 9 '06 #9
Rio Liaden
25 New Member
Or you could put the same code in the AfterUpdate event of the calendar control perhaps, and save on the extra command button?
When I click on the calendar on the date I need, it puts it in every line. When I change it for the next line, all lines are populated by the new date and so on. I can send a screen shot if necessary.
Nov 9 '06 #10

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

Similar topics

11
14414
by: Bobbak | last post by:
Hello All, I have these tables (lets call it ‘EmpCalls', ‘EmpOrders', and ‘Stats') that each contain the list of EmployeeIDs, I want to be able to create a Module in which I could call in my VB form (by clicking and command button)that will add a column (field) to each table and label it with the current date that is specified in my form. Does anyone know how I can go about doing this? Any suggestion will be greatly appreciated.
6
3077
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a record such as: part number 202354-001 location C1-01
5
1756
by: hasanainf | last post by:
Hi, Need help on this report My report displays as follows Receipt Number Checkout Date Payment Date 13580 30-06-2005 02-07-2005 13581 01-07-2005 02-07-2005
3
4885
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
0
928
by: wellery | last post by:
I'm trying to work out how to do this. So far I keep getting errors "Unable to find control ID..." What I've got is a datefield control which draws a calendar popup and a text field. I draw two of these date fields on a page by adding them to the controls collection. The dates work fine however I want to add validation to them to ensure the first date is less than the second date but this isn't working. So far I'm doing this: //creat...
5
3481
by: GarryJones | last post by:
I have code numbers in 2 fields from a table which correspond to month and date. (Month, Code number) Field name = ml_mna 1 2 3 etc up to 12 (Data is entered without a leading zero)
2
2565
by: dympna | last post by:
Hi can anyone suggest a fix for this... as I am a novice in access. I have created a training table with the following fields Employee Name - joe Training Received - Fork lift Date Received - 20/6/07 Certificate - yes What I want to create is a renewal date for this training, there are
17
3452
by: ginajohnst | last post by:
Hi All. I'm having a problem adding days to a date. My date is in the string format dd/mm/yyyy eg. 23/08/2007 in my form field. I can't work out how to add 50 days to that date and then write it to another form field.
3
2637
by: Celal | last post by:
Hi, I couldn't get around a problem about decimal rounding up when adding a record to a table from a form by programming a button. I have an invoice form where the grand total is a calculated text field. The command button "cmdProcess" is supposed to add some fields (customer no, invoice date, grand total (as receivable), currency etc) to a table which keeps track of customer transactions. However, the decimals of grand total field is rounded...
1
4910
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the events when click on that date that perticular event displyed in a text box.But my requirement is to when click on that date that related event displyed in same td row not the text box. and also i add the events to that calendar.plz advice how to...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9020
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.