vba Query for column name

I

ismail

Please help me in this issue....here is my code..and tabel struct.

column name datatype

dateofS date
stid number
stname text
petrol number
dessel number
store number
oils number
totalS number


in the form i have 3 combo box list
in first combo i have values like petrol,dessel,store,oils (user may select
any one of this)
in second i have stid (user may select 1 or 2 or 3......etc)
in third i will select the date value (01/09/2005 or 02/06/2005......)

my query as follows...



Dim strSQL As String
Dim d8, d9 As Variant

d8 = Forms!searchfrm!activitycmb
strSQL = "SELECT " & d8 & ",dateofS,totalS ,stid FROM details where stid=" &
Forms!searchfrm!stidcmb & ""
strSQL = Replace(strSQL, " & Forms!searchfrm!stidcmb & ",
Forms!searchfrm!activitycmb)


activitycmb will give petrol or dissel or oil etc....
forms!searchfrm!stidcmb will give stid



Set r1s = asDB.OpenRecordset(strSQL)

Me.RecordSource = strSQL
r1s.MoveFirst
Do While r1s.EOF = False

Me.Text8.ControlSource = Forms!searchfrm!activitycmb
r1s.MoveNext
Loop

it is working fine i am able to display the values petrol or dissel etc..in
my report
my Question is how can display other values in the query like dateofS,totalS
,stid.


please help me i am very much confussed..

Thanks in advance
 
J

JohnFol

If the combo has the column count higher than 1 (to accomodate the other
fields) you can reference them in much the same way you do with this line

Me.Text8.ControlSource = Forms!searchfrm!activitycmb

Stick another text box on and try this
Me.NewTextBoxName.ControlSource = Forms!searchfrm!activitycmb.column(1)
 
I

ismail

Kindly look into this matter....if i use xxxxxx.column(1) i get error message
runtime error 451
"property let procedure not difined and property get procedure did not
return object"

i would like to display in my rpt...the other fields from my query..

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top