-------------------------------------
==>But I get an error.
Me said:
..what error message(s) did you get?
Please tell us WHAT error message you are getting.
-------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------------------------------
==>I know txtAnswer isn't associated with anything on the form. I really need the [HIGHLIGHT]table name[/HIGHLIGHT] not the account name.
There we go, then. So you want to feed the
Account Name to the function/procedure, and you want to return the
table name to the form (Answer).
-------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------------------------------
==>On the form I have 2 text boxes: txtAccountName to enter the search criteria and txtTableName for the results of the search.
So, txtTableName = txtAnswer in the example...
txtTableName = SearchAll(txtAccountName)
-------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------------------------------
==>Also, I'm confused about this part of the code:
For Each tdf In db.TableDefs
If InStr(tdf.Name, "~") Then
ElseIf InStr(tdf.Name, "MYS") Then
Else...
I'm not sure what to put after "Then"
That's a method I've used for some time now, and I believe others here use it, in order to eliminate system and temporary tables from the results. You wouldn't put anything in the
Then portion, but rather under the final
Else portion.
Code:
For Each tdf in db.TableDefs
If InStr(tdf.Name, "~") Then
ElseIf InStr(tdf.Name, "MYS") Then
Else
[GREEN]'Code to add the table name into the search/query SQL code.[/GREEN]
End If
Well, actually that method may not be
the best method, in case you end up having "MYS" in the middle of any of your table names... so you could end up needing to use a
Left function in that as well to make sure the left 3 characters do not equal that... I just saw a reference on that yesterday - I
may can find it again if you need to see it.
-------------------------------------
--
"If to err is human, then I must be some kind of human!" -Me