VB Code:
  1. Sub Save1()
  2. Dim msql As String
  3. Dim rsTmp As ADODB.Recordset
  4.  
  5. msql = "insert into tbnotajual(tanggal)values('" & dptanggal & "')"
  6. con_data.Execute msql
  7.  
  8. msql = "select * from tbnotajual" & _
  9.        "where nonota in (select max(NoNota) from tbnotajual)"
  10. Set rsTmp = con_data.Execute(msql)
  11. If Not (rsTmp Is Nothing) Then
  12.    If (Not rsTmp.BOF) And (Not rsTmp.EOF) Then
  13.       txtnota.Text = rsTmp.Fields("NoNota").Value
  14.    End If
  15.    rsTmp.Close  
  16. End If
  17. 'rs.Requery  'why are you requerying this recordset? what is its query?
  18. txtkodebarang.SetFocus
  19.  
  20. End Sub