Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2004, 12:46 PM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Raif
Default referential integ. not being enforced?

I have the tables dates and daysofweek. there is a rel. btwn dates.week and daysofweek.monday with ref int. enforced.
when I create new record and add a date in dates.week via the form with a daysofweek subform it creates a corresponding record in daysofweek as you would expect. However, when I do it in code using addnew it creates new record in dates but not in daysofweek . Here is my code

Dim db As DAO.Database
Dim rsDOW As DAO.Recordset
Dim dtSelweek As Date
Dim rsDates As DAO.Recordset
Set db = CurrentDb
Set rsDOW = db.OpenRecordset("select * from daysofweek", dbOpenDynaset)

Set rsDates = db.OpenRecordset("SELECT * from dates", dbOpenDynaset)

rsDOW.FindFirst "monday = #" & Me.selweek & "#"

If rsDOW.NoMatch Then
With rsDates
.AddNew
!Week = Me.selweek
.Update
.Bookmark = .LastModified
End With

Else
DoCmd.Beep
MsgBox "whoo hoo"
Thanks for any advice
Raif






Similar Threads
Thread Thread Starter Forum Replies Last Post
UserID Membership & Referential Integrity bkosscus BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 August 28th, 2006 02:35 AM
foreign key constraints - referential integrity DTSDeveloper SQL Server DTS 0 September 6th, 2005 01:10 PM
xml referential integrity mescalito XML 0 December 10th, 2004 08:33 AM
Referential Integrity owain SQL Language 2 May 12th, 2004 03:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.