title: MS Access .Movenext / .moveprevious
body: <p>So I am attempting to use <code>tblReceipts</code> variable as a recordset, which works, and it is set in the form_load, but when I try to use it in the move next and move previous buttons, it says the variable isn't set, it seems like it initializes the variable, but only for the form load, but doesn't carry through the rest of the code, is there a way to make it public?</p>
  
  <p>The error I get is: error 91, Object variable or with block variable not set</p>
  
  <pre><code>Private Sub Form_Load()
  
  Dim tblReceipts As Recordset
  Set tblReceipts = CurrentDb.OpenRecordset("SELECT * FROM [tblReceipts]", dbOpenDynaset)
  
  tblReceipts.MoveFirst
  Me.RecieptID.Value = tblReceipts![ReceiptID]
  Me.RefNo.Value = tblReceipts![ReferenceNumber]
  Me.TrackingID.Value = tblReceipts![TrackingNumber]
  Me.CustID.Value = tblReceipts![CustomerID]
  Me.CustPostcode.Value = tblReceipts![CustomerPostcode]
  
  End Sub
  
  
  Private Sub btnNext_Click()
  
  MsgBox "There are no more records to show", vbOKOnly, "End of file"
  
  Exit Sub
  
  If tblReceipts.EOF Then
  
  Else
  
  tblReceipts.MoveNext
  Me.RecieptID.Value = tblReceipts![ReceiptID]
  Me.RefNo.Value = tblReceipts![ReferenceNumber]
  Me.TrackingID.Value = tblReceipts![TrackingNumber]
  Me.CustID.Value = tblReceipts![CustomerID]
  Me.CustPostcode.Value = tblReceipts![CustomerPostcode]
  
  End If
  
  
  End Sub
  </code></pre>
  
  <p>Any help is appreciated and I will try to answer any questions.</p>