Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2006

Tip: Looking for answers? Try searching our database.

Restricting Data Between Tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nanette - 02 Dec 2006 18:23 GMT
I'm looking for code that will allow me to restrict inputting data in one
table if data is not found in another table.

Tables:
tblParts.PartNo
tblMasterPartList.PartNo

I need to have the tblParts.PartNo field check the tblMasterPartList.PartNo
field to make sure there is an existing part number in the
tblMasterPartList.PartNo.And, if yes, allow an entry into the tblParts.PartNo
field/table. If there is no matching part number found in the
tblMasterPartList.PartNo field, I need to return a message that says, "go see
Mark for permission".

I'm fairly new at programming, so if you can provide the code I'd be
greatful. Or fi you know someplace where I could find the code to do this.
Marshall Barton - 02 Dec 2006 20:03 GMT
>I'm looking for code that will allow me to restrict inputting data in one
>table if data is not found in another table.
[quoted text clipped - 9 lines]
>tblMasterPartList.PartNo field, I need to return a message that says, "go see
>Mark for permission".

You need to use a form to display/add/edit the records in
tblParts.  Then you could use the PartNo text box's
BeforeUpdateEvent:

If DCount("*", "tblMasterPartList", _
                        "PartNo=" & Me.txtPartNo) = 0 Then
    Me.txtPartNo.Undo
    Cancel = True
    MsgBox "go see Mark for permission"
End If

Signature

Marsh
MVP [MS Access]

Nanette - 02 Dec 2006 21:07 GMT
Thanks a bunch Marshall,

I'm going to work this, wish me luck!

> >I'm looking for code that will allow me to restrict inputting data in one
> >table if data is not found in another table.
[quoted text clipped - 20 lines]
>     MsgBox "go see Mark for permission"
> End If
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.