View Full Version : HElp Debugging


Insentive
04-24-2008, 03:25 PM
What is wrong with this code
Private Sub Command161_Click()
On Error GoTo Err_Command161_Click
Dim num As Integer
Dim Test As String
Dim MainVal As String
Dim varInfoID As String
Dim varAppealID As String
Dim varAppeal As String
Dim strSQL As String
varAppeal = Me.Combo4.Value
varAppealID = DLookup("AppealID", "ProposedAppealNames", "Appeal Name=" & varAppeal)
num = 1



Do While x < 26
If IsEmpty(cbo & " " & num) Then
x = x + 1
Else
MainVal = cbo & " " & x
varInfoID = DLookup("ID1", "ProposedInformationToCapture", "Information=" & MainVal)
strSQL = "INSERT INTO Appeals([AppealID],[InfoID]) VALUES ('" & varAppealID & "','" & varInfoID & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
x = x + 1
End If
Loop






Exit_Command161_Click:
Exit Sub

Err_Command161_Click:
MsgBox Err.Description
Resume Exit_Command161_Click

End Sub


It has an error and i dont see anythign wrong with it at all, can anyone point me to my fault.

RuralGuy
04-24-2008, 03:31 PM
It would be helpful if you would tell us what the error is and on what line of the code.

Insentive
04-24-2008, 10:13 PM
It doesnt specifiy the line of code it just says something about expects a action t be fired and problems with the OLE server. I will get oyu the EXACT error is necessary.

RuralGuy
04-25-2008, 06:22 AM
If you go to a code module (<ALT> F11) and then Tools>Options>General tab you can set your system to "Break on All Errors". Now running the system to the error will leave you on a line of code that is highlighted.

odin1701
04-25-2008, 06:41 AM
Well for one, you have the variable num.

You set it's value to 1 and never change it throughout the whole program.

You can just type 1 in instead of the variable num, but I suspect you've forgotten to increment it.

That may not be your error but we'd need the actual error and such to help with that.