Please help with If Then Else code

Tech-Archive recommends: Fix windows errors by optimizing your registry



I cannot get these 'if then else response.write' codes to work can
someone please help

The database, I have two tables (relationship)

contactTBL (one) and membershipTBL (many)
contactTBL - primary key - contactID
membershipTBL - foreign key - contactID

All I want to do is set up a statement that returns a response.write
"no memberhsip on file" if contactID is not in the membershipTBL - ie
if the person has no membership, then their 'contactID' would not
appear in the membershipTBL, and I would like to tell them when they
login that 'You dont have any membership'

Here is some code that may help, the site is protected by the
contactID set as CID:

<%Your_Name = request.cookies("remain")%>
<%Date_In = request.cookies("still")%>
<%CID = request.cookies("CID")%>
<%If request.cookies("remain") = "" then response.redirect
("login.html")%>
<%Dim MyLogin

Set MyLogin = Server.CreateObject("ADODB.Connection")
ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; "
ConnStr = ConnStr & "DBQ=" & Server.MapPath("..\fpdb\aata.mdb")
MyLogin.Open(ConnStr)
%>
</html>
<body>
<%dim oRS
Set oRS= MyLogin.execute("Select * From membership_TBL WHERE
contactID=" & CID & "")%>
<%If oRS.EOF = " " AND oRS.BOF = " " then response.write "You have no
membership"%>

--

The error is ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record

Note there is another connection above this in the code to another
table in the database, that code is:

<%Dim RS
Set RS = MyLogin.execute("SELECT * FROM contactTBL WHERE contactID=" &
CID & "")
%>
Welcome, <%=Your_Name%>

Thanks in Advance
Rob

.



Relevant Pages

  • Re: Please help with If Then Else code
    ... | The database, ... | contactTBL and membershipTBL ... | membershipTBL - foreign key - contactID ... | <%Dim MyLogin ...
    (microsoft.public.frontpage.programming)
  • Re: Please help with If Then Else code
    ... | The database, ... | contactTBL and membershipTBL ... | membershipTBL - foreign key - contactID ... | <%Dim MyLogin ...
    (microsoft.public.frontpage.programming)
  • Re: Linking Main Contact Table
    ... tblMaster. ... try and learn database design and get the tables right ... database set up as soon as possible. ... ProjectTitle; LeadEngineer (long integer format to link with contactID); ...
    (microsoft.public.access.forms)
  • Re: How do I show more than one contact type for a contact?
    ... You would need to add a new table to the database. ... It would hold the ContactID and the CategoryID. ... > hoping to tweak it to meet my needs. ...
    (microsoft.public.access.queries)
  • Failed insert query
    ... I'm trying to port some data from one database table to another ... WHERE Exists (SELECT ContactID FROM newdatabase.dbo.contacts) ... INSERT statement conflicted with COLUMN FOREIGN KEY constraint ... ContactID) and the contactsevent (foreign key ContactID) table. ...
    (comp.databases.ms-sqlserver)