PDA

Click to See Complete Forum and Search --> : Using strings to manipulate text boxes on forms in Access


Brettrb
Aug 12th, 1999, 08:09 PM
I am now creating a report in Microsoft Access that will need to use strings to come up with the information source.

i.e. A user submits information on a form which determines for a query which fields to take from a table and which records. Now the report needs to take the information from the new query, which changes each time the user uses the form. As far as I know (please tell me if otherwise), I have to know the specific names of the fields I want to call from the query (their names from in the original table), so if I want to pull information from the new query I need to use a string in visual basic to link to the new field (using information from the form). As of yet I have been unable to do this. I need to set the text boxes to the query's fields, but I need to use the information from the user to know which fields to call.

Please help if you know how I can use strings in Visual Basic and then to place it into the text box (I can almost do the string manipulation now, but Access doesn't like me to just set a text box equal to some string)

JHausmann
Aug 13th, 1999, 11:04 AM
It sounds like you want to allow the users to chose the fields they want to use to retrieve data from the database. These should be known and constant. You could create, on your form, combo (or list) boxes matched to a text box. The user then selects the field from the combo/list box and enters the value they want to search for.

The actual mechanics of the query would be like:

select * from table where " & listbox(index).text & "= " textbox.text

(you need to tailor the select statement for string/date data to include delimiters - quotes)

Brettrb
Aug 13th, 1999, 11:12 AM
Yes I did that, which creates the query that I am now using. However I want to also now use the query (which changes each time) to create a report in Access. The Query is nice but I need to format the data created in the query to make a good looking report that we can send out. So I don't need to create the query anymore (it works fine now), I just need to be able to pull the information from the query based either upon it's column number or using the input from the user to code text boxes on the report to access the new query.

Thanks for your help