HElp Debugging

Insentive

Registered User.
Local time
Today, 19:23
Joined
Mar 12, 2008
Messages
13
What is wrong with this code
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.
 
It would be helpful if you would tell us what the error is and on what line of the code.
 
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.
 
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.
 
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.
 

Users who are viewing this thread

Back
Top Bottom