Hi
When a code is entered in the piece field i want to add a line automatically and requery the table to show the new items and bookmark the record i was working on after the requery.... but it didn't work so far.
if someone can help me it would be nice
heres the code i use
Dim Base As Database
Dim RowID As Integer
Dim RstPiece, RstDetailFacture As Recordset
Dim Frm As Form
On Error Resume Next
Set Base = CurrentDb
Set Frm = Me!DetailFacture
RowID = Me.IdDetailFacturation
If Me.IdPiece.Column(1) = "PN" Then
Set RstDetailFacture = Base.OpenRecordset("SELECT * from detailfacture")
With RstDetailFacture
.AddNew
!IDFacture = Forms!facturation!IDFacture
!DateFacture = Forms!facturation!DateFacture
!IdPiece = 11 ' code de taxes de pneu
.Update
End With
End If
Set RstPiece = Base.OpenRecordset("select * from piece where idpiece = " & Me.IdPiece)
If Not RstPiece.EOF Then
'Me.DescItem = RstServices!DescServiceVente
Me.DescItem = RstPiece!DescPiece
Me.Vendant = RstPiece!PrixVendant
End If
Frm.Form.Requery
Frm.Recordset.FindFirst "IdDetailFacturation=" = RowID
RstPiece.Close
Set Base = Nothing
thanks for your help
When a code is entered in the piece field i want to add a line automatically and requery the table to show the new items and bookmark the record i was working on after the requery.... but it didn't work so far.
if someone can help me it would be nice
heres the code i use
Dim Base As Database
Dim RowID As Integer
Dim RstPiece, RstDetailFacture As Recordset
Dim Frm As Form
On Error Resume Next
Set Base = CurrentDb
Set Frm = Me!DetailFacture
RowID = Me.IdDetailFacturation
If Me.IdPiece.Column(1) = "PN" Then
Set RstDetailFacture = Base.OpenRecordset("SELECT * from detailfacture")
With RstDetailFacture
.AddNew
!IDFacture = Forms!facturation!IDFacture
!DateFacture = Forms!facturation!DateFacture
!IdPiece = 11 ' code de taxes de pneu
.Update
End With
End If
Set RstPiece = Base.OpenRecordset("select * from piece where idpiece = " & Me.IdPiece)
If Not RstPiece.EOF Then
'Me.DescItem = RstServices!DescServiceVente
Me.DescItem = RstPiece!DescPiece
Me.Vendant = RstPiece!PrixVendant
End If
Frm.Form.Requery
Frm.Recordset.FindFirst "IdDetailFacturation=" = RowID
RstPiece.Close
Set Base = Nothing
thanks for your help