This topic is locked

Help with a Query...

8/2/2008 1:50:17 AM
ASPRunnerPro General questions
D
dorlisa author

I need help with a query...
I have two tables:

  • tblSIRR
  • PC_DB_080108



The primary key in and it is also the

Foreign key in [color=#FF0000]PC_DB_080108
When new records are added to the PC_DB_080108.
I know my Query is wrong, can someone lead me in the right direction here?
SELECT [tblSIRR].[reqID], [tblSIRR].[reqActMgr], [tblSIRR].[reqASM], [tblSIRR].[reqEngMgr], [tblSIRR].[reqEng], [tblSIRR].[reqEngAdd], [tblSIRR].[cusCustomer]

FROM [tblSIRR], INNER JOIN [PC_DB_080108]

ON [tblSIRR].[reqID]=[PC_DB_080108].[reqID]

WHERE [PC_DB_080108].[reqID]<>[tblSIRR].[reqID]

J
Jane 8/4/2008

Hi,
to check record in the detail table use After record added event and Check if specific record exist action.

D
dorlisa author 8/4/2008

Thanks Jane.
Okay, I found the code for that. Can you look at my code below? Did I do this right?
'** Check if specific record exists ****

strSQLExists = "select * from '"

set rsExists = CreateObject("ADODB.Recordset")

rsExists.Open strSQLExists, dbConnection
if not rsExists.eof then

' if record exists do something
else

' if dont exist do something else

[color=#FF0000]If it is not a match then I would like that record to be added to the tbl_PCDB_080108. See my code below.
INSERT INTO tbl_PCDB_080108
end if

rsExists.Close : set rsExists = Nothing

J
Jane 8/4/2008

To insert new record use Insert record into another table action as a sample.

All entered values are stored in the dict collection:

strSQLExists = "select * from tbl_PCDB_080108 where RequestNum='" & dic("reqID") & "' AND Propyr>='8/1/2008'"