If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Adding date fields to table design
I am attempting to make a table with 5 years of date on it
When i add Date2 field i get nothing It runs fine with only date and week field wanting to make date = Monday Date2= Tuesday Date3= Wednesday Date4=Thursday Date 5 =Friday Any help is appreciated Thank you Public Sub MakeTable() Dim db As DAO.Database Dim td As DAO.TableDef Dim fd As DAO.Field Dim rs As DAO.Recordset Dim dtmdate As Date Set db = CurrentDb() ' Create a new table Set td = db.CreateTableDef("tblWeek1") ' Create a new field Set fd = New DAO.Field fd.Name = "Date" fd.Type = dbDate ' Add the field to the table td.Fields.Append fd ' Create a new field Set fd = New DAO.Field fd.Name = "Date2" fd.Type = dbDate ' Add the field to the table td.Fields.Append fd ' Create a new field Set fd = New DAO.Field fd.Name = "WeekNo" fd.Type = dbText ' Add the field to the table td.Fields.Append fd ' Add the table to the database db.TableDefs.Append td ' Open the table Set rs = td.OpenRecordset ' Add dates and weekno For dtmdate = #10/24/2005# To #12/31/2010# Step 7 rs.AddNew rs!Date = dtmdate rs!Date1 = dtmdate+1 rs!WeekNo = Year(dtmdate) Mod 10 & Right("0" & Format(dtmdate, "ww"), 2) rs.Update Next rs.Close End Sub |
#2
|
|||
|
|||
Adding date fields to table design
" wrote:
I am attempting to make a table with 5 years of date on it When i add Date2 field i get nothing It runs fine with only date and week field wanting to make date = Monday Date2= Tuesday Date3= Wednesday Date4=Thursday Date 5 =Friday Why? This table structure is TOTALLY incorrectly normalized. You should have a one to many relationship, with one date field in five records. What is the intended purpose of this table? I'm sure there's an easier way to go that doesn't involve this structure at all! -- John W. Vinson[MVP] |
#3
|
|||
|
|||
Adding date fields to table design
using this table for a schedule form
schedule date could be 6 months out i got it to work had date2 instead of date1 but any advice on making simpler would be appreciated |
#4
|
|||
|
|||
Adding date fields to table design
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table design problem? | Melissa | Database Design | 29 | November 18th, 2005 04:14 AM |
Access combo box-show name, not ID, in table? | write on | New Users | 30 | April 30th, 2005 09:11 PM |
Many-to-many implementation problem | Al Williams | Database Design | 15 | April 29th, 2005 05:19 PM |
Design help, please | SillySally | Using Forms | 27 | March 6th, 2005 04:11 AM |
Complicated Databse w/many relationships | Søren | Database Design | 7 | July 13th, 2004 05:41 AM |