Click to See Complete Forum and Search --> : how to make column of table 1 = to column of table 2?
gilgalbiblewhee
10-11-2004, 09:40 PM
I want MS Access 2000 database column of table 1 = column of table 2.
This is what I was doing:
<%
'Option Explicit
'Response.End
Response.Buffer=false
Dim letter
'SQL = "SELECT bible.book_spoke, biblewheel_url.letter FROM bible, biblewheel_url WHERE bible.book_spoke=biblewheel_url.book_spoke"
SQL = "SELECT * FROM biblewheel_url WHERE "
strConn = GetConnectionString()
SQL = SQL & "letter(biblewheel_url.book_spoke) = rs(bible.book_spoke)"
Set letter = Server.CreateObject("ADODB.Recordset")
letter.CursorLocation = adUseClient
letter.Open SQL, strConn, adOpenForwardOnly, adLockReadOnly
%>
<%=letter("url")%>
<%
letter.Close
set letter = Nothing
%>
and to pull url address of table 2 to which record it is =to
simflex
10-12-2004, 08:00 AM
Your question isn't very clear.
Are you saying you want to *add* column from table1 to table2 or you want column from table1 to be *equal* to column in table2
or do you mean something utterly different?
What is the relationship between table1 and table2?
In short, what are you trying to accomplish?
gilgalbiblewhee
10-12-2004, 12:38 PM
Ok first, no matter what I do I get this:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Undefined function 'letter' in expression.
/wheelofgod/letters.asp, line 18
My goal is to make *equal* as you said. In table one there are many numbers (about 31000) but ranges from 001-022. Table 2 has only 22 records. I want the "book_spoke" of table 1 be equal to "book_spoke" of table 2. Example if the query gives a record the value of the "book_spoke", let's say 014 has to match the 014 of table 2. This is because I have assigned 22 different urls in table 2. Table 1 has id as primary and table 2 has (as I've assigned) book_spoke as primary. I don't know if that's the correct way of doing it. But in any case there is the problem quoted above.
ranji1323
10-12-2004, 01:43 PM
this line: letter(biblewheel_url.book_spoke)
Is letter a function here that your passing one variable to?
gilgalbiblewhee
10-12-2004, 03:11 PM
Honestly I don't know what a "Function"'s function is. If "rs" represents a recordset that's what "letter" is supposed to be also. Do I make sense?
ranji1323
10-12-2004, 03:29 PM
your database thinks: letter(biblewheel_url.book_spoke)
is a function call to a function called letter which probably doesn't exist based on what your saying.
gilgalbiblewhee
10-12-2004, 05:50 PM
I had that before.
Ok I tried:
Microsoft VBScript compilation error '800a03ea'
Syntax error
/wheelofgod/letters.asp, line 7
call function(letter)
-----^
gilgalbiblewhee
10-12-2004, 05:51 PM
<%
'Option Explicit
'Response.End
Response.Buffer=false
call function(letter)
'SQL = "SELECT bible.book_spoke, biblewheel_url.letter FROM bible, biblewheel_url WHERE bible.book_spoke=biblewheel_url.book_spoke"
SQL = "SELECT * FROM biblewheel_url WHERE "
strConn = GetConnectionString()
'SQL = SQL & "letter(biblewheel_url.book_spoke) = rs(bible.book_spoke)"
SQL = SQL & "letter(biblewheel_url.book_spoke) = '" & spoke & "'"
Set letter = Server.CreateObject("ADODB.Recordset")
letter.CursorLocation = adUseClient
letter.Open SQL, strConn, adOpenForwardOnly, adLockReadOnly
%>
<%=letter("url")%>
<%
letter.Close
set letter = Nothing
%>
javaNoobie
10-12-2004, 10:55 PM
Originally posted by gilgalbiblewhee
Honestly I don't know what a "Function"'s function is. If "rs" represents a recordset that's what "letter" is supposed to be also. Do I make sense?
I know what you mean. You will have to include quotes for the recordset.letter("<columnName here>")
NOTE: Your code still will not work. This is because your SQL statement is wrong.
SQL = SQL & "letter(biblewheel_url.book_spoke) = '" & spoke & "'"
Set letter = Server.CreateObject("ADODB.Recordset")
You have yet to set 'letter' to be a recordset hence you cannot access anything in it.
Function is a reserved word. You can't call it.
Function str(str1)
str = str1 & " Lalala"
End Function
dim string1
string1 = str("hahaha")
response.write(string1)
gilgalbiblewhee
10-13-2004, 01:03 AM
I will look at it tommorrow and I'll let you know.