VBA filter on unbound forms

  • Thread starter Thread starter mobrun
  • Start date Start date
M

mobrun

I have an Access database with multiple unknown tables (tables are
generated/named by the users) the front interface needs to be flexible
and pull information from the unknown tables. Now I have selection
criteria in the form to tell the VBA what the table name is. But since
I cannot attach any forms to any specific tables i'm running into a
problem with some sorts and filters i tried to apply with VBA. All the
tables share the same structure since they are all generated from the
same template, but individual changes are being made to personalize
each table. and its the info from the changed tables i need to return
to the form.

This form here only contains a text box that holds the Test Scenarios,
there are only 36 test scenarios but the box returns 80 items (36
scenarios and 44 blanks) how can i filter for blanks?

Private Sub Form_Load()
Dim TableName As String
TableName = Forms!frmMaster!cmboClient.Value
Me.RecordSource = TableName
Me.TestScenario.ControlSource = "TestScenario"
End Sub

What am I missing?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Instead of using

Me.RecordSource = TableName

try this:

Me.RecordSource = "SELECT * FROM " & TableName & " WHERE " & _
"TestScenario IS NOT NULL"

This assumes that there is a column named "TestScenario" in the table.
The WHERE clause filters out all the rows where the TestScenario is
NULL.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRCWtJIechKqOuFEgEQLS4gCg4jL9QvnGz/kPcgrBt9czpOKkYHQAoOIF
41JwzH4DdLp4ryqKuQ/xQ+AT
=qobP
-----END PGP SIGNATURE-----
 
Back
Top