Vb code

N

Nandini

I have created user interface to retrieve data using combination of more than
three fields from two tables. For this I used three types of combo boxes on
the form. Two boxes for boolean operators (And or, not), three for selecting
searching criteria of 8 fields and three for putting keywords are used here.
One command button is to execute the queries. The necessary parameter queries
are designed. The code of If--Then--ElseIf is written. But after certain
number of procedures, I got the compile error message: 'Too large procedure'.
I used Access 2003. What should I do? Anyone can help me?
With best regards,
 
S

Steve Sanford

There shouldn't be a problem with the*number* of procedures, unless the MDB
approaches 4GB.

It sounds more like you have a problem with a specific procedure. If you
would post the procedure, it would be easier to help with the problem.

HTH
 
N

Nandini

Sorry, I wrote the wrong words 'number of procedures'. Actually there is a
number of Statements (If--then ElseIf) within a procedure. If the number
exceeds 243, then I got the error message 'procedure is too large'. Please
help me any way.
With best regards,
 
D

Douglas J. Steele

If the MDB approaches 4 Gb, you've got major problems, since the limit is 2
Gb!
 
S

Steve Sanford

I knew that.... :)

Too much time reading about SQL Express. Maybe its starting to sink in.....

Thanks John
 
N

Nandini

My MDB is of 35mb at this stage. Now I am sending my code. But all the
statements couldnt be written here. You please guess all of them through your
expart knowledge, the number of which is 245.

Private Sub Command15_Click()
If IsNull(Me.AS1) Then
MsgBox "You must put keywords or phrases at least at the first two boxes. "
ElseIf IsNull(Me.AS2) Then
MsgBox "You must put keywords or phrases at least at the first two boxes. "

'Got values of five combos at once
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Title") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1a", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1b", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1c", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Title") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1d", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1e", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1f", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Title") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1g", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1h", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq1i", "", , acNormal

'Got values of five combos at once
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2a", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2b", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2c", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Subject") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2d", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2e", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2f", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2g", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2h", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq2i", "", , acNormal


ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Title") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3a", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3b", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3c", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Title") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3d", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3e", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3f", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Title") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3g", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3h", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq3i", "", , acNormal


ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4a", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4b", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4c", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Subject") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4d", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4e", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4f", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4g", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4h", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq4i", "", , acNormal

ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Author") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5a", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5b", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5c", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Author") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5d", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5e", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5f", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Author") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5g", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5h", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "Document", acNormal, "Asq5i", "", , acNormal

ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Author") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6a", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6b", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "And") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6c", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Author") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6d", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6e", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Or") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6f", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Author") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6g", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6h", "", , acNormal
ElseIf (C5 = "Author") And (C2 = "Not") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq6i", "", , acNormal

ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Author") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7a", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7b", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7c", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Author") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7d", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7e", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7f", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Author") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7g", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7h", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq7i", "", , acNormal

ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Subject") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8a", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8b", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Subject") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8c", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Subject") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8d", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8e", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8f", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Subject") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8g", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8h", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Subject") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq8i", "", , acNormal

ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Author") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9a", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9b", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9c", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Author") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9d", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9e", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9f", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Author") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9g", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9h", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq9i", "", , acNormal

ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Subject") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10a", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10b", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Subject") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10c", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Subject") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10d", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10e", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10f", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Subject") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10g", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10h", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Subject") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq10i", "", , acNormal

ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Title") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11a", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11b", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11c", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Title") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11d", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Title") And (C3 = "Or") And
(C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11e", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11f", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Title") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11g", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11h", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "Document", acNormal, "Asq11i", "", , acNormal


ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Title") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12a", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12b", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "And") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12c", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Title") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12d", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Title") And (C3 = "Or") And
(C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12e", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Or") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12f", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Title") And (C3 = "And")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12g", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12h", "", , acNormal
ElseIf (C5 = "Title") And (C2 = "Not") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Subject") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq12i", "", , acNormal

ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Title") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13a", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13b", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13c", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Title") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13d", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13e", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13f", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Title") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13g", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13h", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq13i", "", , acNormal

ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Title") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14a", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14b", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14c", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Title") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14d", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14e", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14f", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Title") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14g", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Title") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14h", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Title") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq14i", "", , acNormal

ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Author") And (C3 =
"And") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15a", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15b", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Author") And (C3 =
"Not") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15c", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Author") And (C3 = "And")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15d", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15e", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15f", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Author") And (C3 =
"And") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15g", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15h", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Author") And (C3 =
"Not") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq15i", "", , acNormal

ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Author") And (C3 =
"And") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16a", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16b", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Author") And (C3 =
"Not") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16c", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Author") And (C3 = "And")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16d", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16e", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Author") And (C3 = "Not")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16f", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Author") And (C3 =
"And") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16g", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Author") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16h", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Author") And (C3 =
"Not") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq16i", "", , acNormal

ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17a", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Subject") And (C3 =
"Or") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17b", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17c", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17d", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17e", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17f", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17g", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"Or") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17h", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Author") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq17i", "", , acNormal


ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18a", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Subject") And (C3 =
"Or") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18b", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "And") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18c", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18d", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Subject") And (C3 = "Or")
And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18e", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Or") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18f", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"And") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18g", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"Or") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18h", "", , acNormal
ElseIf (C5 = "Subject") And (C2 = "Not") And (C6 = "Subject") And (C3 =
"Not") And (C7 = "Title") Then
DoCmd.OpenForm "SIEQ", acNormal, "Asq18i", "", , acNormal
End If
End Sub

With best regards
 
S

Steve Sanford

Yes, that would cause a problem. :)

A couple more things....

Is the record source for the form a table or a query? If it is a query,
please post the SQL of the query.


And would you post the SQL of these queries: "Asq1a", "Asq2a" & "Asq9a" ?
 
D

David W. Fenton

My MDB is of 35mb at this stage. Now I am sending my code. But all
the statements couldnt be written here. You please guess all of
them through your expart knowledge, the number of which is 245.

Private Sub Command15_Click()
If IsNull(Me.AS1) Then
MsgBox "You must put keywords or phrases at least at the first
two boxes. " ElseIf IsNull(Me.AS2) Then
MsgBox "You must put keywords or phrases at least at the first
two boxes. "

You clearly have major design errors in your schema, seems to me.
 
N

Nandini

Record source is table. The sql view of the query 'Asq1a' is
SELECT (" "+[Cn]+" ") & ([S1]+" ") & ([S2]+" ") & ([S3]+" ") & ([Cn1]+" ") &
([S1a]+" ") & ([S2a]+" ") & ([S3a]+" ") & ([P1]+" ") AS Author, (" "+) &
(" "+[T]+" ") & ([O]+" ") AS Expr1, (" "+[D]+" ") & ([Dr]+" ") & ([Dm]+" ") &
([E]+" ") & ([Es]+" ") & ([E1]+" ") & ([E2]+" ") & ([F1]+" ") & ([F2]+" ") &
([F3]+" ") & ([F4]+" ") & ([F5]+" ") & ([F6]+" ") & ([F7]+" ") & ([F8]+" ") &
([F9]+" ") & ([F10]+" ") & ([Ac]+" ") & ([A1]+" ") & ([A2]+" ") & ([A3]+" ")
& ([A4]+" ") & ([AA]+" ") & ([Em]+" ") & ([Em1]+" ") & ([Em3]+" ") & ("
"+[Tm]+" ") AS Expr2
FROM Ds INNER JOIN Si ON Ds.[D Id] = Si.[D Id]
WHERE ((((" "+[Cn]+" ") & ([S1]+" ") & ([S2]+" ") & ([S3]+" ") & ([Cn1]+" ")
& ([S1a]+" ") & ([S2a]+" ") & ([S3a]+" ") & ([P1]+" ")) Like "*" &
[Forms]![A]![AS1] & "*") AND (((" "+) & (" "+[T]+" ") & ([O]+" ")) Like
"*" & [Forms]![A]![AS2] & "*") AND (((" "+[D]+" ") & ([Dr]+" ") & ([Dm]+" ")
& ([E]+" ") & ([Es]+" ") & ([E1]+" ") & ([E2]+" ") & ([F1]+" ") & ([F2]+" ")
& ([F3]+" ") & ([F4]+" ") & ([F5]+" ") & ([F6]+" ") & ([F7]+" ") & ([F8]+" ")
& ([F9]+" ") & ([F10]+" ") & ([Ac]+" ") & ([A1]+" ") & ([A2]+" ") & ([A3]+"
") & ([A4]+" ") & ([AA]+" ") & ([Em]+" ") & ([Em1]+" ") & ([Em3]+" ") & ("
"+[Tm]+" ")) Like "*" & [Forms]![A]![AS3] & "*") AND ((Si.Fd) Like "*" &
[Forms]![A]![F] & "*") AND ((Ds.Tg) Like "*" & [Forms]![A]![G] & "*"));
The sql view of the query 'Asq2a' is
SELECT (" "+[Cn]+" ") & ([S1]+" ") & ([S2]+" ") & ([S3]+" ") & ([Cn1]+" ") &
([S1a]+" ") & ([S2a]+" ") & ([S3a]+" ") & ([P1]+" ") AS Author
FROM Ds INNER JOIN Si ON Ds.[D Id] = Si.[D Id]
WHERE ((((" "+[Cn]+" ") & ([S1]+" ") & ([S2]+" ") & ([S3]+" ") & ([Cn1]+" ")
& ([S1a]+" ") & ([S2a]+" ") & ([S3a]+" ") & ([P1]+" ")) Like "*" &
[Forms]![A]![AS1] & "*") AND (((" "+[D]+" ") & ([Dr]+" ") & ([Dm]+" ") &
([E]+" ") & ([Es]+" ") & ([E1]+" ") & ([E2]+" ") & ([F1]+" ") & ([F2]+" ") &
([F3]+" ") & ([F4]+" ") & ([F5]+" ") & ([F6]+" ") & ([F7]+" ") & ([F8]+" ") &
([F9]+" ") & ([F10]+" ") & ([Ac]+" ") & ([A1]+" ") & ([A2]+" ") & ([A3]+" ")
& ([A4]+" ") & ([AA]+" ") & ([Em]+" ") & ([Em1]+" ") & ([Em3]+" ") & ("
"+[Tm]+" ")) Like "*" & [Forms]![A]![AS2] & "*") AND (((" "+) & (" "+[T]+"
") & ([O]+" ")) Like "*" & [Forms]![A]![AS3] & "*") AND ((Si.Fd) Like "*" &
[Forms]![A]![F] & "*") AND ((Ds.Tg) Like "*" & [Forms]![A]![G] & "*"));
The sql view of the query 'Asq2a' is
SELECT (" "+) & (" "+[T]+" ") & ([O]+" ") AS Expr1, (" "+[D]+" ") &
([Dr]+" ") & ([Dm]+" ") & ([E]+" ") & ([Es]+" ") & ([E1]+" ") & ([E2]+" ") &
([F1]+" ") & ([F2]+" ") & ([F3]+" ") & ([F4]+" ") & ([F5]+" ") & ([F6]+" ") &
([F7]+" ") & ([F8]+" ") & ([F9]+" ") & ([F10]+" ") & ([Ac]+" ") & ([A1]+" ")
& ([A2]+" ") & ([A3]+" ") & ([A4]+" ") & ([AA]+" ") & ([Em]+" ") & ([Em1]+"
") & ([Em3]+" ") & (" "+[Tm]+" ") AS Expr2
FROM Ds INNER JOIN Si ON Ds.[D Id] = Si.[D Id]
WHERE ((((" "+) & (" "+[T]+" ") & ([O]+" ")) Like "*" & [Forms]![A]![AS1]
& "*") AND (((" "+[D]+" ") & ([Dr]+" ") & ([Dm]+" ") & ([E]+" ") & ([Es]+" ")
& ([E1]+" ") & ([E2]+" ") & ([F1]+" ") & ([F2]+" ") & ([F3]+" ") & ([F4]+" ")
& ([F5]+" ") & ([F6]+" ") & ([F7]+" ") & ([F8]+" ") & ([F9]+" ") & ([F10]+"
") & ([Ac]+" ") & ([A1]+" ") & ([A2]+" ") & ([A3]+" ") & ([A4]+" ") & ([AA]+"
") & ([Em]+" ") & ([Em1]+" ") & ([Em3]+" ") & (" "+[Tm]+" ")) Like "*" &
[Forms]![A]![AS2] & "*" And ((" "+[D]+" ") & ([Dr]+" ") & ([Dm]+" ") & ([E]+"
") & ([Es]+" ") & ([E1]+" ") & ([E2]+" ") & ([F1]+" ") & ([F2]+" ") & ([F3]+"
") & ([F4]+" ") & ([F5]+" ") & ([F6]+" ") & ([F7]+" ") & ([F8]+" ") & ([F9]+"
") & ([F10]+" ") & ([Ac]+" ") & ([A1]+" ") & ([A2]+" ") & ([A3]+" ") &
([A4]+" ") & ([AA]+" ") & ([Em]+" ") & ([Em1]+" ") & ([Em3]+" ") & ("
"+[Tm]+" ")) Like "*" & [Forms]![A]![AS3] & "*") AND ((Si.Fd) Like "*" &
[Forms]![A]![F] & "*") AND ((Ds.Tg) Like "*" & [Forms]![A]![G] & "*"));
Thanks for your kind help'
With regards,

nandini
 
N

Nandini

Another things I want to say you that after getting error message 'procedure
too large', when I go to 'Help' I get 'Code for this procedure exceeds 64K
when compiled. Break this, and any other large procedures, into two or more
smaller procedures.'
But I dont know how its possible to break the procedure.
Thanks for your kind help.
With best regards,
 
J

John Keith

When ever you find that the statements you are coding have a repeating
pattern, there will be a more concise way to structure the code to avoid
explicitly testing for every combination. There will undoubtedly be other
possible ways to code this but here is one that should get you back within
the number of statements limit.

Private Sub Command15_Click()
Dim sMsg as String
Dim sQueryName as String
Dim sChoices as String, sOps as String
Dim sQNum as String, sQLtr as String
sMsg = MsgBox "You must put keywords or phrases at least at the first two
boxes. "

If IsNull(Me.AS1) or IsNull(Me.AS2) Then
MsgBox sMsg
Exit Sub
End If

sChoices = C5 & C6 & C7
Select Case sChoices
Case "AuthorTitleSubject"
sQNum = "1"
Case "AuthorSubjectTitle"
sQNum = "2"
Case "AuthorTitleTitle"
sQNum = "3"
Case "AuthorSubjectSubject"
sQnum = "4"
Case "AuthorAuthorTitle"
sQNum = "5"
Case "AuthorAuthorSubject"
sQNum = "6"
Case "TitleAuthorSubject"
sQNum = "7"
Case "TitleSubjectAuthor"
sQNum = "8"
Case "TitleAuthorAuthor"
sQNum = "9"
Case "TitleSubjectSubject"
sQNum = "10"
Case "TitleTitleAuthor"
sQNum = "11"
Case "TitleTitleSubject"
sQNum = "12"
Case "SubjectTitleAuthor"
sQNum = "13"
Case "SubjectTitleTitle"
sQNum = "14"
Case "SubjectAuthorTitle"
sQNum = "15"
Case "SubjectAuthorAuthor"
sQNum = "16"
Case "SubjectSubjectTitle"
sQNum = "17"
Case "SubjectSubjectTitle"
sQNum = "18"
Case Else
MsgBox "Error in Choices=" & sChoices
exit Sub
End Select

'Select could be written as a series of If then - ElseIf's also:
sOps = C2 & C3
If sOps = "AndAnd" then
sQLtr = "a"
elseIf sOps = "AndOr" then
sQLtr = "b"
elseIf sOps = "AndNot" then
sQLtr = "c"
elseIf sOps = "OrAnd" then
sQLtr = "d"
elseIf sOps = "OrOr" then
sQLtr = "e"
elseIf sOps = "OrNot" then
sQLtr = "f"
elseIf sOps = "NotAnd" then
sQLtr = "g"
elseIf sOps = "NotOr" then
sQLtr = "h"
elseIf sOps = "NotNot" then
sQLtr = "i"
else
MsgBox "Error in Operators:" & sOps
end if

sQueryName = "Asq" & sQNum & sQLtr
DoCmd.OpenForm "SIEQ", acNormal, sQueryName, "", , acNormal
End sub

Also something else to think about, the 4th parm of the DoCmd.OpenForm
allows a Where condition, it may have been possible to pass that in to filter
the form without having to have multiple queries. That parm could be built
as a string variable in a similar fashion. Data types become important
though. I.E. enclosing text in (')Single quotes, dates in (#) pound signs,
numbers without special symbols etc.

HTH
 
S

Steve Sanford

Looks like John's solution helped you.

After looking at the VBA and the queries ('Asq1a' for example), I have to
agree with David W. Fenton: it looks like you have major design errors.

I don't know what you are modeling, but you are doing all of the work,
instead of Access. If you add another item to "C5", you will have to modify
your code and queries. With proper design, changing the code and queries
wouldn't be necessary.

good luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top