Search form and error 3175

Clarabella

New member
Local time
Today, 12:16
Joined
Nov 30, 2012
Messages
5
Hi all,
I am totally baffled by a form based on a query I've been working on for a long time (years? :banghead:).

It is a very specialized search form with multiple fields (17!).
The form is unbound and I have three buttons that I use to perform different operations:
1) opens a new form with all results form the query
2) filters an existing form according to the parameters of the query
3) filters another existing form according to the paramenters of the query

I only have 1 query and if I open it directly it's working fine.
Button 1 works OK
Button 2 works OK

The code behind button 2 and 3 is the same, only the controls and fields name is different.

Problem is, when I launch Button 3 I get a 3175 error about wrongly set parenthesis:

This is the code that is giving the error:

If Len(Me.Titolo_Album) > 0 Then
If Len(stLinkCriteria) > 0 Then
stLinkCriteria = stLinkCriteria & " AND ([Tbl_Audio_PRINCIPALEALBUM.Title] like '*" & Replace(Me![Titolo_Album], "'", "''") & "*')"
Else
stLinkCriteria = " ([Tbl_Audio_PRINCIPALEALBUM.Title] like '*" & Replace(Me![Titolo_Album], "'", "''") & "*')"
End If
End If

Could anyone pinpoint the problem or push me in the right direction?
If needed I can post more code.

Thank you!
Erika
 
Erika, Could you give the exact error description??

Also could you shed some light on the replace function you have placed.. Why Replace and why have you replaced a single quotes with two single quotes.
 
Hi Paul,

sorry for the late reply. I've been away for the weekend and managed to think about the issue a bit more and I found the mistake (well no mistake in the form, really, but there was a structural fault in the database...).

>Why Replace and why have you replaced a single quotes with two single quotes

I admit defeat: no idea what my code means.
When I started working on my search form, I did not know where to start, so I looked around and started copying and pasting from newsgroups.
In the end the results were very "wobbly" to say the least. I asked for help in the Italian Access newsgroup and one of the Access MVPs who were helping there was so nice to send me an example of the code, both for text boxes as well as for comboboxes.
Since then I've been blindly following what she told me to do and never questioned the code itself, since the form was working flawlessly.

The problems I reported were being caused by a flaw in the most important tables I wrote about 6 years ago: my database started as a tiny little project, with one table and one form, then it grew and I started expanding it, but since my knowledge was very limited, I ended up with some duplicate names in the tables.
I never had any problems until now, when I started mixing data from different tables into my query.

Last night I went back and changed all names so that there are no duplicates and now the form is working flawlessly again.

You can see what it looks like in the attachment.

Thanks again for your help!!
Erika
 

Attachments

  • Appunti01.jpg
    Appunti01.jpg
    66.6 KB · Views: 109

Users who are viewing this thread

Back
Top Bottom