View Full Version : 1 form and three tables.


Talismanic
10-30-2000, 05:42 AM
I want to update three tables with one form. How do I set this up. I thought I could connect the three tables with a query and then bind the query to the form but it didn't work correctly. I can view the data from all three tables but it wouldnt let me add any new records. Any ideas?

Here is the query:


SELECT DISTINCTROW TimeRegular.ID, TimeRegular.JobNumber,
TimeRegular.JobName, TimeRegular.CAR, TimeRegular.FIN,
TimeRegular.PLA, TimeRegular.LAB, TimeRegular.LAT,
TimeRegular.CPT, TimeRegular.SFLR, TimeRegular.TIL,
TimeRegular.AC1, TimeRegular.AC2, TimeRegular.AC3,
TimeRegular.AC4, TimeRegular.AF2, TimeAndHalf.ID,
TimeAndHalf.Jobnumber, TimeAndHalf.JobName,
TimeAndHalf.CAR, TimeAndHalf.FIN, TimeAndHalf.PLA,
TimeAndHalf.LAB, TimeAndHalf.LAT, TimeAndHalf.CPT,
TimeAndHalf.SFLR, TimeAndHalf.TIL, TimeAndHalf.AC1,
TimeAndHalf.AC2, TimeAndHalf.AC3, TimeAndHalf.AC4,
TimeAndHalf.AF2, TimeDouble.ID, TimeDouble.JobNumber,
TimeDouble.JobName, TimeDouble.CAR, TimeDouble.FIN,
TimeDouble.PLA, TimeDouble.LAB, TimeDouble.LAT, TimeDouble.CPT,
TimeDouble.SFLR, TimeDouble.TIL, TimeDouble.AC1, TimeDouble.AC2,
TimeDouble.AC3, TimeDouble.AC4, TimeDouble.AF2

FROM (TimeRegular INNER JOIN TimeAndHalf ON (TimeRegular.JobName =
TimeAndHalf.JobName) AND (TimeRegular.JobNumber = TimeAndHalf.Jobnumber))
INNER JOIN TimeDouble ON (TimeAndHalf.JobName = TimeDouble.JobName)
AND (TimeAndHalf.Jobnumber = TimeDouble.JobNumber);

Pat Hartman
10-30-2000, 01:20 PM
First, you should not have three tables, you should have one table to hold time.

Second, just because tables have the same key that doesn't mean they should joined this way. Using your query, you will only get regular time records if you have cooresponding records in both timeandahalf and doubletime.

If you don't want to change the table structure you can create a mainform to show regular time and two subforms for the other time tables. Just make sure the master/child links are properly set so the forms stay in sync.

Keith P
10-30-2000, 03:19 PM
I haven't considered the logic of your code but try changing the forms recordset type to'Dynaset(inconsistent updates)'. This will sometimes allow updates to more than one table.