Assign SQL Field to Textbox Recordsource

Sorrells

Registered User.
Local time
Today, 04:32
Joined
Jan 13, 2001
Messages
258
Greetings,

I will continue to look for this but thought an entry here might speed the time taken to solution.

I have a report in which I assign the report RecordSource with a SQL statement in the OnOpen event. The selection of SQL is dependent on the current value of a global variable.

There are only 2 variances in one SQL statement from the other. These are fields reflecting English or Spanish strings. For example one field is Room_Custom and in the other SQL it is Room_Custom_SP.

In the report detail, I have a textbox named Room_Custom. It works fine with the English SQL but for the Spanish, I want it to take the value of Room_Custom_SP.

So after the SQL statement, I attempted to directly assign the recordSource as follows:

Room_Custom.RecordSource = [Room_Custom_SP]

This returns Access runtime error 2465 "can't find the field referenced". I have tried a variety of syntaxes for the above statement but thus far to no avail.

I'd appreciate any suggestions.
 
I found the answer:

Me.txtYourTextControl.ControlSource = "[FieldName]"
 

Users who are viewing this thread

Back
Top Bottom