Problem deleting last record(item)
Error i happening while I run my application. I am having trouble with my application. I have a Flex Grid running on my application. I have a Copy - Delete and New item buttons on my application. I can successfully delete the items (recordsets) on the grid however when I am deleting the last item left on the grid, I get a Run-time error which says "Can not remove last non-fixed row" Error 30015. Fairly news to VB please help me
Thanks in advance //let me know if u need any further info
CODE:
Private Sub Command2_Click()
FGActions.RemoveItem (FGActions.Row) ->>> ERROR REPORTED
End Sub
********************
CODE FOR FGAction
**********************
Private Sub FGActions_DblClick()
With FGActions
GCol = .Col
GRow = .Row
If .Row <> 0 And .Col < 2 Then
CellText.Top = .CellTop + .Top
CellText.Left = .CellLeft + .Left
CellText.Height = .CellHeight
CellText.Width = .CellWidth
CellText.Text = .Text
CellText.Visible = True
CellText.SetFocus
End If
If .Row > 0 And .Col = 3 Then
If .Text = "Running" Then
.Text = "Shut down"
Else
.Text = "Running"
End If
End If
If .Row > 0 And .Col = 2 Then
Combo2.Visible = True
Combo2.Top = .CellTop + .Top
Combo2.Left = .CellLeft + .Left
'Combo2.Height = .CellHeight
Combo2.Width = .CellWidth
End If
End With
End Sub
**************************
Private Sub FileNewAnalysis_Click()
Dim MyDB As Database, thesql As String, theset As Recordset
Dim MyDB2 As Database, thesql2 As String, theset2 As Recordset
CD.DialogTitle = "Enter the name of the new session..."
CD.Filter = "MS Access Database Files (*.mdb)|*.mdb|All Files (*.*)|*.*"
CD.filename = ""
CD.ShowOpen
temp2 = CD.filename
If temp2 = "" Then
StatusBar1.Panels(2).Text = "Filename not valid. Operation aborted."
Call FileClose_Click
Exit Sub
Else
GlobalVar.MainDBName = temp2
End If
thestart:
CD.DialogTitle = "Enter the file name and location to import..."
CD.Filter = "MS Access Database Files (*.mdb)|*.mdb|All Files (*.*)|*.*"
CD.filename = ""
CD.ShowOpen
temp = CD.filename
If temp = "" Then
StatusBar1.Panels(2).Text = "Filename not valid. Operation aborted."
Exit Sub
End If
Set MyDB = OpenDatabase(temp)
thesql = "SELECT * FROM FMEAData"
On Error Resume Next
Set theset = MyDB.OpenRecordset(thesql)
If Err.Number <> 0 Then
MsgBox ("The file is not of recognized format. Please retry.")
GoTo thestart
End If
Err.Clear
theset.Close
CreateMainDB temp2
Set MyDB = OpenDatabase(temp)
Set MyDB2 = OpenDatabase(temp2)
thesql = "SELECT * FROM ATeam"
Set theset = MyDB.OpenRecordset(thesql)
Set theset2 = MyDB2.OpenRecordset(thesql)
Do While theset.EOF = False
theset2.AddNew
For k = 0 To theset.Fields.Count - 1
theset2.Fields(k) = theset.Fields(k)
Next k
theset2.Update
theset.MoveNext
Loop
thesql = "SELECT * FROM GenInfo"
Set theset = MyDB.OpenRecordset(thesql)
Set theset2 = MyDB2.OpenRecordset(thesql)
Do While theset.EOF = False
theset2.AddNew
For k = 0 To theset.Fields.Count - 1
theset2.Fields(k) = theset.Fields(k)
Next k
theset2.Update
theset.MoveNext
Loop
thesql = "SELECT * FROM FMEAData"
thesql2 = "SELECT * FROM MPSData"
Set theset = MyDB.OpenRecordset(thesql)
Set theset2 = MyDB2.OpenRecordset(thesql2)
Do While theset.EOF = False
theset2.AddNew
For k = 0 To theset.Fields.Count - 1
theset2.Fields(k) = theset.Fields(k)
Next k
theset2.Update
theset.MoveNext
Loop
thesql = "SELECT * FROM FMEAMaintActions"
thesql2 = "SELECT * FROM MPSMaintActions"
Set theset = MyDB.OpenRecordset(thesql)
Set theset2 = MyDB2.OpenRecordset(thesql2)
Do While theset.EOF = False
theset2.AddNew
For k = 0 To theset.Fields.Count - 1
theset2.Fields(k) = theset.Fields(k)
Next k
theset2.Update
theset.MoveNext
Loop
LoadExistingFMEA temp2
LoadAssemMainTree temp2, Combo1.Text
LoadATeamGenInfo temp2
MPSMain.Caption = "Setting (Database in use: " & GlobalVar.MainDBName & ")"
End Sub