no ) but Extra ) in query expression error

S

Sue R

I have searched through numerous forums looking for an answer, but could not
find one with the exact problem, but I apologize in advance if it's out there
and I missed it.

I have taken over a database at work from a previous employee so am lost...
When attempting to open a form from a command button at startup I receive the
message "Run-time error '3075': Extra ) in query expression '??empInformation.
EmpReferenceID="2239-EMP-01"))'.
I can not find an expression that looks like this anywhere in the database.

When I select Debug the following code comes up: (With the line "frmMain.
OrderBy = "EmpLastName DESC" highlighted).
Option Compare Database
Option Explicit
Dim rsMain As ADODB.Recordset

Sub modSetReferenceID(frmMain As Form, strIDValue1 As String, strIDValue2 As
String, txtReference As TextBox)

rsMain.Requery
txtReference.SetFocus
If txtReference.Text = "" Then
If rsMain.RecordCount <= 8 Then
txtReference.Value = strIDValue1 & rsMain.RecordCount + 1
Else
txtReference.Value = strIDValue2 & rsMain.RecordCount + 1
End If
End If

End Sub

Sub modDataInputLoad(frmMain As Form, strTableName As String, txtReference As
TextBox)

txtReference.Locked = True
frmMain.OrderByOn = True
frmMain.OrderBy = "EmpLastName DESC"

Set rsMain = New ADODB.Recordset
rsMain.CursorLocation = adUseClient
rsMain.Open "SELECT * FROM " & strTableName, CurrentProject.Connection,
adOpenDynamic, adLockOptimistic


End Sub

Thank you so much to anyone with a suggestion!
Sue
 
D

Douglas J Steele

What's the code you're using to open the form? It sounds as though you're
passing a filter or where clause that's buggy.
 
S

Sue R

Douglas said:
What's the code you're using to open the form? It sounds as though you're
passing a filter or where clause that's buggy.
I have searched through numerous forums looking for an answer, but could not
find one with the exact problem, but I apologize in advance if it's out there
[quoted text clipped - 43 lines]
Thank you so much to anyone with a suggestion!
Sue


Private Sub cmdOpenEmpInfo_Click()
On Error GoTo Err_cmdOpenEmpInfo_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEmployeeInformation"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenEmpInfo_Click:
Exit Sub

Err_cmdOpenEmpInfo_Click:
MsgBox Err.Description
Resume Exit_cmdOpenEmpInfo_Click

End Sub
Private Sub cmdSkillQuery_Click()
On Error GoTo Err_cmdSkillQuery_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmSelectSkill"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdSkillQuery_Click:
Exit Sub

Err_cmdSkillQuery_Click:
MsgBox Err.Description
Resume Exit_cmdSkillQuery_Click

End Sub
 

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