Internal Error while running Dialog box with list box
Forums
Hi Brian,
I'm sure somebody might have asked you the question.
I'm coming back to idea scripting after three years and almost forgot all the tips and tricks.
Previously i have created many macros with list box but not rememebr facing this issue.
I'm getting internal error for the below example. I have defined the array for list box seperately but still facing issue. I'm using idea 10 version. Do you see something that i'm missing? I have a 3000 line code having this problem. so, just created an example with simple list box.
code:
Dim sridhar() AS string
Begin Dialog NewDialog 50,49,251,150,"NewDialog", .NewDialog ListBox 72,38,85,14, sridhar(), .ListBox1 PushButton 108,82,40,14, "Button", .PushButton1End Dialog
Sub Main
ReDim sridhar(2) sridhar(0) = "1"sridhar(1) = "2"
dim button as stringbutton = Dialog(newdialog)MsgBox button
If button =1 Then
Set db = Client.OpenDatabase("COA-Sheet1.IMD") Set task = db.Extraction task.AddFieldToInc "TB_ACCOUNT_NUMBER" dbName = "EXTRACTION1.IMD" task.AddExtraction dbName, "", "" task.CreateVirtualDatabase = False task.PerformTask 1, db.Count Set task = Nothing Set db = Nothing Client.OpenDatabase (dbName)
End If
MsgBox button.ListBox1
End Sub
Regards,
Sridhar
Hi Brian,
Hi Brian,
Now i understood why i was getting internal error. That was because of the last message box which was pointing to button . listbox1 but there is no object called button. button is declared as string.
Also In my original code (3000 line) i found out why i recieved the internal error. I had multiple list boxes but in one of the list box i forgot to mention the array variable. I was trouble shooting for two days and got frustrated and finally asked your help. I closely watched how your reformatted script works but mine throws internal error. finally found it, thank for your continued support for all the members.
Regards,
Sridhar
Hello,
Hello,
I have a similar problem. I am traying to extract different databases, in a for loop. But I get the error message in the task.PerformTask j, db.Count point.
This is the subfunction I am using:
Function Extraccion1()
Dim num_nombre As String
Dim nom_nombre As String
Dim nombre As String
Dim myArray(0,2)
num_nombre = "1"
nom_nombre = "Bote"
Set db = Client.OpenDatabase("Tabla para trabajar.IMD")
Set task = db.Extraction
task.IncludeAllFields
Set rs = db.RecordSet
rs.ToFirst
count = rs.Count
For j = 1 To count
'Dim temp_count As Long
'nombre = nom_nombre & "-" & num_nombre & ".IMD"
rs.Next
Set rec = rs.ActiveRecord
Erase myArray
myArray(0,0) = rec.GetCharValue("ID")
myArray(0,1) = rec.GetCharValue("REFERENCIA")
myArray(0,2) = rec.GetNumValue("IMPORTE")
Set rec = Nothing
'task.IncludeAllFields
nombre = nom_nombre & "-" & num_nombre & "." & CStr(j) & ".IMD"
task.AddExtraction nombre, "", "ID == "" myArray(0,0) "" .AND. REFERENCIA == ""myArray(0,1) "" .AND. IMPORTE == myArray(0,2)"
'task.CreateVirtualDatabase = False
MsgBox db.Count
task.PerformTask j, db.Count
MsgBox "hasta aquí bien"
Client.OpenDatabase(nombre)
num_nombre=CStr(CInt(num_nombre) + 1)
Next j
Set task=Nothing
Set db=Nothing
Set rs = Nothing
End Function
Hi Clara, your equation isn't
Hi Clara, your equation isn't formed properly and that might be the problem. When using variables you need to reference them outside of the double quotes and use the & to join them such as:
"ID == """ & myArray(0,0) & """ .AND. REFERENCIA == """ & myArray(0,1) & """ .AND. IMPORTE == " & myArray(0,2)
If you still have errors then what I would do is put the above in a message box so you can see what it looks like and if it is not looking like what you would expect to see in the equation editor then it needs to be adjusted.
eqn = "ID == """ & myArray(0,0) & """ .AND. REFERENCIA == """ & myArray(0,1) & """ .AND. IMPORTE == " & myArray(0,2)
msgbox eqn
Hi Sridhar,
Hi Sridhar,
Welcome back to scripting, I reformatted your script but didn't get any internal errors.
I also made a few changes, I used a file out of the sample project folder to show you what I did. I defined the dialog as dlg and referenced this instead of the NewDialog, that might have been a problem. Your final message box I am now getting the information from the array but telling it which item was returned.
Also you should check to make sure that for your ListBox1 in this case that there is an attached List, usually the add a $ to indicate it is a character but mine seems to run fine with out it but that might also be a problem, so instead of sridhar() try stridhar$() as that indicates it is a character array.
Let me know if anything here helps out any.
Brian