Communication Link Error

C

Cire

Hi all,
pls take a look at this screen shot. I got this error while testing my
application.

http://img162.imageshack.us/img162/8922/commlinkerror9kv.jpg

My application is a front-end to a backend SQL server. I've already
established the odbc connection in control panel, odbc sources followed by
linking my pass-through queries to the odbc connection but i still got this
error. AND the funny thing is that it doesnt always happen. Sometimes it pops
up, sometimes it doesn't and when it doesn't, the application runs perfectly
fine
Not exactly sure whats wrong.. Heres my code:

Option Compare Database

Private Sub cbx_prod_grp_AfterUpdate()
Me.cbx_req_last_name.Requery
Me.cbx_req_first_name.Requery
End Sub

Private Sub cbx_prod_grp_Change()

Dim sqlLastName As String
Dim sqlFirstName As String
Dim qdf As QueryDef
Dim qdf2 As QueryDef
Dim db As Database

' Setting connection and defining query for last name
Set db= CurrentDb()
Set qdf = db.QueryDefs("Fm_CO_Main_qry_cbx_req_last_name")

sqlLastName = "SELECT ctct_1.c_last_name AS [Last Name] "

sqlLastName = sqlLastName & " FROM SVD.grpmem INNER JOIN " & _
" SVD.ctct ON SVD.grpmem.group_id = CASERVICEDESK.ctct.
id INNER JOIN " & _
" SVDctct ctct_1 ON SVD.grpmem.member = ctct_1.id "
quot = "'"
sqlLastName = sqlLastName & " WHERE SVD.ctct.c_last_name = " & quot & Me.
cbx_prod_grp.Value & quot

qdf.Sql = sqlLastName

' Defining 2nd query for first name
Set qdf2 = db.QueryDefs("Fm_CO_Main_qry_cbx_req_first_name")
sqlFirstName = "SELECT ctct_1.c_first_name AS [First Name] "

sqlFirstName = sqlFirstName & " FROM SVD.grpmem INNER JOIN " & _
" SVD.ctct ON SVD.grpmem.group_id = SVD.ctct.id INNER
JOIN " & _
" SVD.ctct ctct_1 ON SVD.grpmem.member = ctct_1.id "
quot = "'"
sqlFirstName = sqlFirstName & " WHERE SVD.ctct.c_last_name = " & quot &
Me.cbx_prod_grp.Value & quot

qdf2.Sql = sqlFirstName
Exit_Procedure:
On Error Resume Next
DoCmd.SetWarnings True
Exit Sub

Error_Handler:
On Error Resume Next
DoCmd.Hourglass False
DoCmd.SetWarnings True
varReturnVal = SysCmd(acSysCmdClearStatus)

MsgBox "An error has occured in this application. " & _
"please contact the technical support person at (e-mail address removed) and " & _
"tell them this information:" & _
vbCrLf & vbCrLf & "Error Number " & Err.Number & ", " & _
Err.Description, _
Buttons:=vbCritical, Title:="SVD Query System"

Resume Exit_Procedure
Resume
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

Similar Threads


Top