Hi,
Does anyone know how to do this? I have combo box lisitng all the controls on a form. When the user selects one or more they go into a list box as Forms!MyForm!FieldName and the field type. The user then selects other items to build a SQL statement such as table fields from another combo box, etc. So the statement looks like this:
select [NAME], [ADDRESS] from MAIN where [NAME] ='" & Forms!MyForm!FieldName & "'"
The Forms!MyForm!FieldName comes from them selecting that form field (control) from the loaded combo box. When I run it through OpenQuery it tries to use Forms!MyForm!FieldName as a piece of data and returns nothing. I want it to go to the open form and get the contents of that fieldname and use its contents in the sql statement. Any ideas?
Does anyone know how to do this? I have combo box lisitng all the controls on a form. When the user selects one or more they go into a list box as Forms!MyForm!FieldName and the field type. The user then selects other items to build a SQL statement such as table fields from another combo box, etc. So the statement looks like this:
select [NAME], [ADDRESS] from MAIN where [NAME] ='" & Forms!MyForm!FieldName & "'"
The Forms!MyForm!FieldName comes from them selecting that form field (control) from the loaded combo box. When I run it through OpenQuery it tries to use Forms!MyForm!FieldName as a piece of data and returns nothing. I want it to go to the open form and get the contents of that fieldname and use its contents in the sql statement. Any ideas?