Re: VB application crashes

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Co" <vonclausowitz@xxxxxxxxx> wrote in message
news:1157662568.878150.322440@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Guys,

Thanks for the advises.
I think I found out where things go wrong. I just don't know why.
When I load the form in Private Sub Form_Activate() I have the
following code:

Call ImageLoader
Call LoadPositions
Call LoadLanguages
Call LoadPeople
Call LoadOrgs
Call LoadEvents
Call LoadUnits
Call LoadDocs
Call LoadReports
Call LoadVehicles
Call LoadEducations
Call LoadResidences

These are functions that load data into Listviews, for example:

Private Function LoadPositions()

Dim rsjob As Recordset
Dim strJob As String
Dim itmX As ListItem

strJob = "SELECT Id, BJID, position_title AS position, employer,
hire_date AS [date hired] FROM Jobs " & _
"WHERE Jobs.BJID = " & theName & " ORDER BY Jobs.hire_date
DESC"

Set rsjob = dbfASIC.OpenRecordset(strJob)

If rsjob.RecordCount <> 0 Then
ListViewPositions.SmallIcons = Main.ImageList1(1)

ListViewPositions.ColumnHeaders.Add , , "Position", 3200
ListViewPositions.ColumnHeaders.Add , , "Employer", 3200
ListViewPositions.ColumnHeaders.Add , , "Date Hired", 1500

rsjob.MoveFirst
Do While rsjob.EOF = False
Set itmX = ListViewPositions.ListItems.Add(, ,
rsjob.Fields("position"), , "Pos")
itmX.Tag = "P" & rsjob.Fields("Id")
itmX.SubItems(1) = IIf(Len(rsjob.Fields("employer") <> 0),
rsjob.Fields("employer"), "")
itmX.SubItems(2) = IIf(Len(rsjob.Fields("[date hired]") <> 0),
rsjob.Fields("[date hired]"), "")
rsjob.MoveNext
Loop
End If
Set rsjob = Nothing

End Function

I used to use the same Public recordset rs all the time but I changed
that. No effect however. Why is the prog crashing on this code? Is it
too much for VB?

MArco

Please open your VBP files with Notepad and post the lines that begin
with "Object=" and "Reference=" here.


.



Relevant Pages

  • Re: VB crashed when I tries to end my programme
    ... Private Sub AddGfrCmd_Click ... Dim mydate As Date ... Load CounterTB ... ' Position the new control. ...
    (microsoft.public.vb.general.discussion)
  • Re: Treeview help
    ... my code which loads the dbgrid fails because it works off the WOID unique ... Dim rsWork As Recordset ... THIS IS TO LOAD THE DBGRID FROM WHICH ID YOU SELECT IN THE TVW ... Private Sub ctltree_MouseDown(Button As Integer, Shift As Integer, x As ...
    (microsoft.public.vb.controls)
  • Re: VB application crashes
    ... When I load the form in Private Sub Form_ActivateI have the ... These are functions that load data into Listviews, ... Set rsjob = dbfASIC.OpenRecordset ... I used to use the same Public recordset rs all the time but I changed ...
    (microsoft.public.vb.general.discussion)
  • User defined Nth_Occurence function fails when new data is loading via macro
    ... This doesn't happen if I load the data manually. ... Private Sub GetCallout_Click ... Dim wdDoc As Variant ... Set rFound = range_look.Find(find_it, rFound, xlValues, ...
    (microsoft.public.excel.programming)
  • Re: VB application crashes
    ... When I load the form in Private Sub Form_ActivateI have the ... These are functions that load data into Listviews, ... Set rsjob = dbfASIC.OpenRecordset ... Set itmX = ListViewPositions.ListItems.Add(,, ...
    (microsoft.public.vb.general.discussion)