View Single Post
  #9  
Old December 3rd, 2005, 07:31 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Calendar and time sheet

I would keep all the data in normalized tables (and ignore or verbally abuse
PC Datasheet).

tblSamples
================
SampleID Autonumber primary key
SampleTypeID link to table containing descriptions
SampleDate
SampleValue

If you really need a form like this, consider
-writing code that loads your data into a "flat" table for editing
more code would be needed to normalize after editing
-create an unbound form like a grid of text boxes.
use code to fill the grid with data and then to
save the data to your normalized table

I wrote some code for another poster a while back the filled a bunch of text
boxes with customer names and order dates from Northwind. One of the keys
was to use a scheme for naming the text boxes as below:

txtCust1 txtOrdDate1_1 txtOrdDate1_2 ...etc...
txtCust2 txtOrdDate2_1 txtOrdDate2_2 ...etc...
txtCust3 txtOrdDate3_1 txtOrdDate3_2 ...etc...
...etc... ...etc... ...etc... ...etc...

The code to fill the text boxes with customers and order dates:
Private Sub cmdPullOrderDates_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intCustomer As Integer
Dim strCustomer As String
Dim intOrder As Integer
strSQL = "SELECT CompanyName, OrderDate " & _
"FROM Customers INNER JOIN " & _
"Orders ON Customers.CustomerID = Orders.CustomerID " & _
"ORDER BY CompanyName, OrderDate"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
rs.MoveFirst
With rs
intCustomer = 0
Do Until .EOF Or intCustomer 2
strCustomer = .Fields("CompanyName")
intCustomer = intCustomer + 1
Me("txtCust" & intCustomer) = strCustomer
intOrder = 0
Do Until strCustomer .Fields("CompanyName") Or intOrder 4
intOrder = intOrder + 1
Me("txtOrdDate" & intCustomer & "_" & intOrder) =
..Fields("OrderDate")
.MoveNext
Loop
Loop
.Close
End With
Set rs = Nothing
Set db = Nothing
End Sub

--
Duane Hookom
MS Access MVP


"Fehn" wrote in message
...
Does anyone know how to make this possible ad updatable in MS Access?

Description - 12/1 - 12/2 - 12/3...... 12/31
Sample1 - 2 - - 5 .....etc
Sample2 - 6 - 8 - 3 .....etc
:
:
etc.


Thanks.