Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 3rd, 2006, 05:28 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cascading Lists Problem

I have two subjects fields on a form these use cascading lists so subject 2 is dependent on whatever is selected in subject 1.
The problem I am having is I am trying to let users add a new record to subject 2.Here is where the problem lies for adding new Subject 2.
Some of the selections in subject 1 have similar selections in subject 2 so trying to add a subject 2 brings up errors

Thanks

Brendan Bartley
__________________
Brendan Bartley
Reply With Quote
  #2 (permalink)  
Old October 3rd, 2006, 06:55 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am not sure where the problem is here. Can you give an example?


mmcdonal
Reply With Quote
  #3 (permalink)  
Old October 3rd, 2006, 07:57 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for you're reply
Example
Subject 1 has three fields Communications Hardware and Software
Subject 2 has fields that are connected to subject 1
Communications Test also Hardware Keyboard Software Download
What I want to do is be able to add to subject 2 for new fields
Thanks

Brendan Bartley
Reply With Quote
  #4 (permalink)  
Old October 3rd, 2006, 12:13 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I assume that there is some kind of action taken once the Subject 1 & Subject 2 fields are selected, probably the display of a record somewhere? If so, what you do is set a Combobox for Subject 2 to take input not restricted to the rowsource, and then when the user hits enter (or clicks a button, or whatever) you do a test to see if there is a record on file for that Subject1/2 combo. If there is, you display it, if not, you issue a dialogue box saying something like "The info for this query does not exist, would you like to enter it?" Yes/No. If they choose yes, pop up a data entry form and save the record off to whatever table you have it in, if they say no, drop em back to your Subject choice form.

Reply With Quote
  #5 (permalink)  
Old October 4th, 2006, 06:52 AM
Friend of Wrox
Points: 912, Level: 11
Points: 912, Level: 11 Points: 912, Level: 11 Points: 912, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for you're reply
I am using the following code so that it will check the table for duplicate entries
Private Sub Subject_BeforeUpdate(Cancel As Integer)
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset

Set rsc = Me.RecordsetClone

SID = Me.Subject2.Value And Me.Subject.Value
stLinkCriteria = "[Subject];[subject2]=" & "'" & SID & "'"


    If DCount("Subject2 and Subject", "tblsubject2", stLinkCriteria) > 0 Then


        Me.Undo

        MsgBox "Warning Customer Already Exists " _
        & SID & " has already been entered." _



    End If

Set rsc = Nothing
End Sub
But this code does not prevent duplicate entries
Thanks

Brendan Bartley
Reply With Quote
  #6 (permalink)  
Old October 4th, 2006, 12:28 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should be able to prevent duplicate entries by setting your primary key to Subject & Subject2 in the table design area.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cascading list problem Vince_421 Access VBA 5 January 30th, 2007 11:41 AM
adding data when using cascading lists Vince_421 Access VBA 0 May 4th, 2006 09:21 AM
got problem with cascading iframes nerssi CSS Cascading Style Sheets 1 June 17th, 2005 11:11 AM
Cascading iframe problem nerssi HTML Code Clinic 0 June 13th, 2005 04:36 AM
Cascading combo lists in continuous forms rjd97c Access 1 June 30th, 2004 02:51 PM



All times are GMT -4. The time now is 02:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.