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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass a field name into recordset 1

Status
Not open for further replies.

cuok

Programmer
Dec 24, 2001
201
Hi friends.
What wrong here:

i m trying to pass a field name from table ("tipolim")
into recordset, in aim to be able to use it with the format rcd!Field=ActiveControl.value

assuming that the variable "ctl" in my strSql detremind correct and so all the query strSql here:

strSQL = "SELECT tipolim.[" & ctl.ControlSource & "], tipolim.DateTodayTipolim, tipolim.[" & ActiveControl.ControlSource & "]"
strSQL = strSQL & " FROM tipolim "
strSQL = strSQL & " WHERE tipolim.[" & ctl.ControlSource & "] = '" & ctl & "' AND tipolim.DateTodayTipolim = #" & [Forms]![frm_Tipolim_Hazana]![Tipolim_Hazana].[Form]![DateTodayTipolim] & "#"

how can i use the part "SELECT tipolim.[" & ctl.ControlSource & "], [\b]....

in code (instead of the 'xxxxxxxxxx')
Set rcd = CurrentDb.OpenRecordset(strSQL)

Do Until rcd.EOF
If rcd!xxxxxxxxxx= [Forms]![frm_Tipolim_Hazana]![Tipolim_Hazana].[Form]![DateTodayTipolim] Then....
End If

Many thanks for any help

CUOK




 
Hi cuok,

You should be able to use ..

rcd.Fields(ctl.ControlSource)

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Good morning to you Tony !

its works great
thank you very much!!

CUOK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top