BOF E EOF
                    boa tarde
na sub abaixo está me retornando bof e eof verdadeiro. Nao tenho dados na tabela mas nem pode ter porque tá no inicio
Private Sub Incluir()
Dim Row As Integer
With rsOficina2
Do Until Row = GrdIncluiPec.Rows + 1
Call NewIdITens
Row = Row + 1
GrdIncluiPec.COL = 0
GrdIncluiPec.Row = Row
If GrdIncluiPec.CellBackColor <> CDbl(&HC0C0C0) Then
If NewRecord = True Then .AddNew
!Itens_nr = IdItens
!Numero_OS = CboNumOS.Text
!Item = GrdIncluiPec.TextMatrix(Row, 0)
!CodPeca = GrdIncluiPec.TextMatrix(Row, 1)
!NomePeca = GrdIncluiPec.TextMatrix(Row, 2)
!Quant = GrdIncluiPec.TextMatrix(Row, 3)
!valor = GrdIncluiPec.TextMatrix(Row, 4)
!TotLinha = GrdIncluiPec.TextMatrix(Row, 5)
.Update
.Requery
End If
Loop
End With
If NewRecord = True Then
Call AtualizaFormulario
CboNumOS.SetFocus
GrdIncluiPec.Clear
Call CabecalhoGrdIncluiPec
End If
End Sub
Private Sub NewIdITens()
Dim NewId As String
[ô]para ver erro
On Error GoTo Erro
With rsOficina2
If .EOF = True And .BOF = True Then
NewId = 1
Else
.MoveLast
NewId = !Itens_nr + 1
End If
IdItens = [Ô][Ô]
IdItens = Format(NewId, [Ô]000000[Ô])
End With
Exit Sub
[ô]para ver erro
Erro:
MsgBox Err.Number & [Ô] [Ô] & Err.Description
End Sub
a mensagem que retorna é [Ô]0[Ô]
Danikull e ashkatchup se puderem ajudar agradeço.
nereu
            na sub abaixo está me retornando bof e eof verdadeiro. Nao tenho dados na tabela mas nem pode ter porque tá no inicio
Private Sub Incluir()
Dim Row As Integer
With rsOficina2
Do Until Row = GrdIncluiPec.Rows + 1
Call NewIdITens
Row = Row + 1
GrdIncluiPec.COL = 0
GrdIncluiPec.Row = Row
If GrdIncluiPec.CellBackColor <> CDbl(&HC0C0C0) Then
If NewRecord = True Then .AddNew
!Itens_nr = IdItens
!Numero_OS = CboNumOS.Text
!Item = GrdIncluiPec.TextMatrix(Row, 0)
!CodPeca = GrdIncluiPec.TextMatrix(Row, 1)
!NomePeca = GrdIncluiPec.TextMatrix(Row, 2)
!Quant = GrdIncluiPec.TextMatrix(Row, 3)
!valor = GrdIncluiPec.TextMatrix(Row, 4)
!TotLinha = GrdIncluiPec.TextMatrix(Row, 5)
.Update
.Requery
End If
Loop
End With
If NewRecord = True Then
Call AtualizaFormulario
CboNumOS.SetFocus
GrdIncluiPec.Clear
Call CabecalhoGrdIncluiPec
End If
End Sub
Private Sub NewIdITens()
Dim NewId As String
[ô]para ver erro
On Error GoTo Erro
With rsOficina2
If .EOF = True And .BOF = True Then
NewId = 1
Else
.MoveLast
NewId = !Itens_nr + 1
End If
IdItens = [Ô][Ô]
IdItens = Format(NewId, [Ô]000000[Ô])
End With
Exit Sub
[ô]para ver erro
Erro:
MsgBox Err.Number & [Ô] [Ô] & Err.Description
End Sub
a mensagem que retorna é [Ô]0[Ô]
Danikull e ashkatchup se puderem ajudar agradeço.
nereu
                    primeiro tente isto
                
            With rsOficina2
    If .Recordcount = 0 Then
        NewId = 1
    Else
        .MoveLast
        NewId = !Itens_nr + 1
    End If
    IdItens = [Ô][Ô]
    IdItens = Format(NewId, [Ô]000000[Ô])
End With
                    Marcelo-treze
retornou a mesma mens
nereu
            retornou a mesma mens
nereu
                    em qual linha ocorre o erro?
                
            
                    sinaliza na linha itens_nr=Iditens
                
            
                    agora to começando a entender, tente a modificação abaixo.
                
            Dim Row As Integer
    With rsOficina2
          Do Until Row = GrdIncluiPec.Rows + 1
            Call NewIdITens
            Row = Row + 1
            GrdIncluiPec.COL = 0
            GrdIncluiPec.Row = Row
            If GrdIncluiPec.CellBackColor <> CDbl(&HC0C0C0) Then
                If NewRecord = True Then
                    .AddNew
                    !Itens_nr = IdItens
                    !Numero_OS = CboNumOS.Text
                    !Item = GrdIncluiPec.TextMatrix(Row, 0)
                    !CodPeca = GrdIncluiPec.TextMatrix(Row, 1)
                    !NomePeca = GrdIncluiPec.TextMatrix(Row, 2)
                    !Quant = GrdIncluiPec.TextMatrix(Row, 3)
                    !valor = GrdIncluiPec.TextMatrix(Row, 4)
                    !TotLinha = GrdIncluiPec.TextMatrix(Row, 5)
                .Update
                .Requery
                End if
            End If
        Loop
End With
                    Private Sub Incluir()
Dim Row As Integer
With rsOficina2
Do Until Row = GrdIncluiPec.Rows + 1
Call NewIdITens
Row = Row + 1
GrdIncluiPec.COL = 0
GrdIncluiPec.Row = Row
If GrdIncluiPec.CellBackColor <> CDbl(&HC0C0C0) Then
If NewRecord = True Then
.AddNew
!Itens_nr = IdItens
!Numero_OS = CboNumOS.Text
!Item = GrdIncluiPec.TextMatrix(Row, 0)
!CodPeca = GrdIncluiPec.TextMatrix(Row, 1)
!NomePeca = GrdIncluiPec.TextMatrix(Row, 2)
!Quant = GrdIncluiPec.TextMatrix(Row, 3)
!valor = GrdIncluiPec.TextMatrix(Row, 4)
!TotLinha = GrdIncluiPec.TextMatrix(Row, 5)
.Update
.Requery
End If
End If
Loop
End With
If NewRecord = True Then
Call AtualizaFormulario
CboNumOS.SetFocus
GrdIncluiPec.Clear
Call CabecalhoGrdIncluiPec
End If
retorna erro 30009 [Ô]Invalid row value[Ô] e sinaliza no sublinhado.
            Dim Row As Integer
With rsOficina2
Do Until Row = GrdIncluiPec.Rows + 1
Call NewIdITens
Row = Row + 1
GrdIncluiPec.COL = 0
GrdIncluiPec.Row = Row
If GrdIncluiPec.CellBackColor <> CDbl(&HC0C0C0) Then
If NewRecord = True Then
.AddNew
!Itens_nr = IdItens
!Numero_OS = CboNumOS.Text
!Item = GrdIncluiPec.TextMatrix(Row, 0)
!CodPeca = GrdIncluiPec.TextMatrix(Row, 1)
!NomePeca = GrdIncluiPec.TextMatrix(Row, 2)
!Quant = GrdIncluiPec.TextMatrix(Row, 3)
!valor = GrdIncluiPec.TextMatrix(Row, 4)
!TotLinha = GrdIncluiPec.TextMatrix(Row, 5)
.Update
.Requery
End If
End If
Loop
End With
If NewRecord = True Then
Call AtualizaFormulario
CboNumOS.SetFocus
GrdIncluiPec.Clear
Call CabecalhoGrdIncluiPec
End If
retorna erro 30009 [Ô]Invalid row value[Ô] e sinaliza no sublinhado.
                    Vamos lá vamos ver mais esta alteração
tente agora
                
            Private Sub Incluir()
Dim Row As Integer
    With rsOficina2
     For Row = 1 To GrdIncluiPec.Rows - 1
            If GrdIncluiPec.CellBackColor <> CDbl(&HC0C0C0) Then
                If NewRecord = True Then
                    .AddNew
                    !Itens_nr = IdItens
                    !Numero_OS = CboNumOS.Text
                    !Item = GrdIncluiPec.TextMatrix(Row, 0)
                    !CodPeca = GrdIncluiPec.TextMatrix(Row, 1)
                    !NomePeca = GrdIncluiPec.TextMatrix(Row, 2)
                    !Quant = GrdIncluiPec.TextMatrix(Row, 3)
                    !valor = GrdIncluiPec.TextMatrix(Row, 4)
                    !TotLinha = GrdIncluiPec.TextMatrix(Row, 5)
                .Update
                .Requery
                End If
            End If
        Next Row
    End With
If NewRecord = True Then
    Call AtualizaFormulario
    CboNumOS.SetFocus
    GrdIncluiPec.Clear
    Call CabecalhoGrdIncluiPec
End If
End Subtente agora
                    nao retornou erro,
mas tambem nao fez nada. nao foi nada pra tabela oficina2
                
            mas tambem nao fez nada. nao foi nada pra tabela oficina2
                    desculpe você deve indicar a linha em foco
tente agora
veja! agora acredito que irá funcionar
                
            tente agora
Private Sub Incluir()
Dim Row As Integer
    With rsOficina2
     For Row = 1 To GrdIncluiPec.Rows - 1
            .Row = Row [ô]faltava esta linha
            If GrdIncluiPec.CellBackColor <> CDbl(&HC0C0C0) Then
                If NewRecord = True Then
                    .AddNew
                    !Itens_nr = IdItens
                    !Numero_OS = CboNumOS.Text
                    !Item = GrdIncluiPec.TextMatrix(Row, 0)
                    !CodPeca = GrdIncluiPec.TextMatrix(Row, 1)
                    !NomePeca = GrdIncluiPec.TextMatrix(Row, 2)
                    !Quant = GrdIncluiPec.TextMatrix(Row, 3)
                    !valor = GrdIncluiPec.TextMatrix(Row, 4)
                    !TotLinha = GrdIncluiPec.TextMatrix(Row, 5)
                .Update
                .Requery
                End If
            End If
        Next Row
    End With
If NewRecord = True Then
    Call AtualizaFormulario
    CboNumOS.SetFocus
    GrdIncluiPec.Clear
    Call CabecalhoGrdIncluiPec
End Ifveja! agora acredito que irá funcionar
                    retornou erro
compile error
[Ô]method or data member not foud[Ô]
e sinalizou na linha .row=row
            compile error
[Ô]method or data member not foud[Ô]
e sinalizou na linha .row=row
                        Tópico encerrado , respostas não são mais permitidas
                    
                
