Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What Am I doing wrong Here???????????????/ 1

Status
Not open for further replies.

rbasram

Programmer
Sep 27, 2001
53
CA
Dim MyDat As Recordset
Dim Titem As Variant
Dim Ritem As Variant
Dim sql As String

sql = "Select * from Bulletins Query1 having [TNum]= lstTNum.column(TItem) and [Product].[ServerName] = lstResult.column(RItem);"
Set MyDat = CurrentDb.OpenRecordset(sql, dbOpenDynaset)

MyDat.Edit
MyDat("DocumentID") = Me.[txtDocID]
MyDat.Update
 
well... What is 'TItem'.... at the point in the function/sub, it doesn't seem to have any value.... just intialization (meaning 0)....

RItem would be the same....

and you probably want to use:

MyDat.Fields("DocumentID") = Me.[txtDocID]

I've not actually tried it, since I don't have the data, and didn't take the time to set something up.... but that's just off the tope of my head....

Gwydion
 
I have the error in these lines it tells me unidentified function lst.column(item) in expression


sql = "Select * from Bulletins Query1 having [TNum]= lstTNum.column(TItem) and [Product].[ServerName] = lstResult.column(RItem);"
Set MyDat = CurrentDb.OpenRecordset(sql, dbOpenDynaset)
 
Ok... I did some testing with list boxes.... and if you have not selected anything in the list box (probably need to test for that) then the value returned from lstresult.column(RItem), where RItem has not been initialized (it has a value of NULL), will return a Null, breaking the SQL...

I may be wrong, though....
 
Hi!

Try this:

sql = "Select * from Bulletins Query1 having [TNum]= " & lstTNum.column(TItem) & " and [Product].[ServerName] = '" & lstResult.column(RItem) & "';"
Set MyDat = CurrentDb.OpenRecordset(sql, dbOpenDynaset)

This assumes that TNum is numeric and ServerName is text.

Finally, I am confused about a couple of things:

What is Query1?
Why are you using having instead of Where?
It looks like you are using more than one table, how are they connected?

hth Jeff Bridgham
bridgham@purdue.edu
 
oh my god.... I'm blind today....

also... you should have brackets ([]) around the query name since it has a space in it... that will also mess up the SQL....

so it should look like:
Code:
sql = "Select * from [Bulletins Query1] having [TNum]= " & lstTNum.column(TItem) & " and [Product].[ServerName] = '" & lstResult.column(RItem) & "';"

that should fix the problem....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top