Forms - Subforms Requery problem

J

John Smith

Here's my problem...

I have a form with a sub form. I have build a button that on "Click", a
form open and ask me the number of transportation à need. When I enter a
number and click OK, everything is work fine. I scroll to my subform and
put the right transportation in my shipping list box.

If I have made a mistake, I click again on my button and enter another
number. Now, nothing works. All I have on my listbox is #DELETED...?

Any idea?
'---------------------------------------------------------------------------
------
Private Sub Valider_Click()
Dim strLv As String
Dim tbLv As Recordset
Dim intdr As Integer
Dim strdel As String

If IsNull(Me.nbShip) Then
MsgBox "Please enter the number of shipping you need", vbInformation,
"Shipping"
Exit Sub
Else
DoCmd.SetWarnings False

strdel = "Delete * From NbShip"
DoCmd.RunSQL (strdel)


strLv = "Select * From NbShip"

Set tbLv = mabd.OpenRecordset(strLv)
If tbLv.RecordCount = 0 Then
For intdr = 0 To Me.nbLivre - 1
tbLv.AddNew
tbLv!nbLivre = intdr + 1
tbLv.Update

Next intdr
End If

Forms!SHIPPING!SUBFORM_SHIPPING.Form.Requery

DoCmd.Close
End If
'---------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top