×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

OR Statement inside Link Child and Master Fields

OR Statement inside Link Child and Master Fields

OR Statement inside Link Child and Master Fields

(OP)
I'm creating a database and I would like to include an OR statement in the field linking.
I have two fields that work together as being unique, so the AND (read: semicolon) works great in that sense.  I would also like to include records that match another field aswell.
I successfully did this using QBF with a stored procedure, however I was unable to insert new records.

Table Layouts:
Cable Records: Cable, Pair, ..., Local, ...
SR/TT Junction: SR/TT, ..., Cable, Pair, Local, ...
SR/TT: SR/TT, Time, Date, Remarks, Pers

I have SR/TT and SR/TT Junction joined in the subform and am looking to link the (Cable and Pair) or Local fields with Cable Records to eliminate the need for a form to show each field link.

I am using a datasheet and it won't let me use multiple subforms.

Using:
MS ACCESS 2003
MS SQL Server 2000

Has anyone done something similar to this?

Thanks,

Banks.

RE: OR Statement inside Link Child and Master Fields

try this

use this stored procedure for the subform


Create procedure spname

@prram1 type,
@pram2 type,
@pram3 type
As


Select field1,field2
from tablename
where field1=@prram1
And field2=@prram2
union
select
Select field1,field2
from tablename
where pram3=fieldxx


return


and in the InputParameters of the subform
@prram1 type=forms!formname!controlname,
@pram2 type=forms!formname!controlname,
@pram3 type=forms!formname!controlname
you might need  a requery on the on current of the main form





return

RE: OR Statement inside Link Child and Master Fields

(OP)
Yes, a stored procedure will retreive records, however I am unable to insert new records through a stored procedure.   

RE: OR Statement inside Link Child and Master Fields

if yo change the SP from a union to an or does it help

Create procedure spname

@prram1 type,
@pram2 type,
@pram3 type
As


Select field1,field2
from tablename
where (field1=@prram1 And field2=@prram2)
or (pram3=fieldxx)


return

 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close