944,153 Members | Top Members by Rank

Ad:
Oct 29th, 2007
0

recordset,sql not sure where my problem is

Expand Post »
Here is my code, it works when I leave away the line in bold, I can't figure out what's wrong with my line in bold, I've been checking my database so many times already, can you help me

Quote ...
With gridMieter
.Cols = 5
.TextMatrix(0, 0) = "Frist_id"
.TextMatrix(0, 1) = "Bau_id"
.TextMatrix(0, 2) = "Liegenschaft"
.TextMatrix(0, 3) = "Mieter"
.TextMatrix(0, 4) = "Kündigungsfrist"
'.COLWIDTH(0) = 0
'.COLWIDTH(1) = 0

adoMieter.RecordSource = "SELECT * FROM tblfrist INNER JOIN (tblMieter INNER JOIN Liegenschaften ON Liegenschaften.Rimo_Liegnr = tblMieter.Rimo_Liegnr) ON tblMieter.frist_id = tblfrist.frist_id"
adoMieter.Refresh

Do While Not adoMieter.Recordset.EOF
.Row = .Rows - 1
.TextMatrix(.Row, 0) = adoMieter.Recordset("tblfrist.Frist_id")
.TextMatrix(.Row, 1) = adoMieter.Recordset("tblfrist.Bau_id")
.TextMatrix(.Row, 2) = adoMieter.Recordset("Liegenschaften.Name")
.TextMatrix(.Row, 3) = adoMieter.Recordset("tblMieter.Name")
.TextMatrix(.Row, 4) = adoMieter.Recordset("Kündigungsfrist")
.Rows = .Rows + 1
adoMieter.Recordset.MoveNext

Loop


End With
Last edited by plusplus; Oct 29th, 2007 at 7:31 am.
Similar Threads
Reputation Points: 10
Solved Threads: 16
Posting Whiz in Training
plusplus is offline Offline
207 posts
since Jul 2007
Oct 29th, 2007
0

Re: recordset,sql not sure where my problem is

Hi,

May be the field tblfrist.Bau_id is Null..

Just Concatenate it with a Blank String :

vb Syntax (Toggle Plain Text)
  1. .TextMatrix(.Row, 1) = adoMieter.Recordset("tblfrist.Bau_id") & ""

Regards
Veena
Last edited by QVeen72; Oct 29th, 2007 at 9:48 am.
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Oct 29th, 2007
0

Re: recordset,sql not sure where my problem is

I'm getting runtime error 3265 -id doesn't seem to find the field bau_id,I don't understand why
Reputation Points: 10
Solved Threads: 16
Posting Whiz in Training
plusplus is offline Offline
207 posts
since Jul 2007
Oct 30th, 2007
0

Re: recordset,sql not sure where my problem is

Hi,

First check if tblfrist table has got bau_id field.
and if it has got and if bau_id is not a common field in bot the used tables, then, just give

.TextMatrix(.Row, 1) = adoMieter.Recordset("Bau_id") & ""

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Oct 30th, 2007
0

Re: recordset,sql not sure where my problem is

Bau_id exists only in one of the tables(thanks for pointing that out), so I changed tblfrist.bau_id to just bau_id and now it works. I'm still not sure why tblfrist.bau_id should cause problems
Reputation Points: 10
Solved Threads: 16
Posting Whiz in Training
plusplus is offline Offline
207 posts
since Jul 2007
Oct 31st, 2007
0

Re: recordset,sql not sure where my problem is

Hi,

If Fields are repeated, then Return Fields in Recordsets are prefixed with Tablename.FieldName ,
or else, only fieldnames are returned unless explicitly mentioned...

REgards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: I'm an apprentice.Please
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: msflexgrid,gridlines





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC