SELECTING RECORDS FROM FORM ADD MODE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that opens in Add mode for users to enter more records. When
the user is finished entering one or more records and before they close the
form, I would like them to be able to push a button to view a report with
just the records they entered since the form was last opened.

What property do I pass to the query to get only these records?
Thanks
 
Dear Albert:

Unless you have designed something (such as a session number) you
cannot do this.

Consider this: If you have two users adding rows to the table, and
one of them presses the "button", then wouldn't you expect that user
to see only the rows he has just added, not the ones added by someone
else.

After giving this some thorough analysis, you can design a way to make
this work, but there's nothing "built in" that will do this.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
I'm able to add a non-visible unbound textbox to the form with =CurrentRecord
as it's control. There's no way to utilize this in some way?
 
Dear Albert:

The CurrentRecord would be one row. You said before, "When the user
is finished entering one OR MORE records . . ." Keeping track of one
record cannot result in selecting several of them.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
I figured out how to do it...

Private Sub Command55_Click()
Dim Test As String
Dim TestGroup As String
Dim strCriteria As String

DoCmd.GoToRecord , , acLast

For k = CurrentRecord To 1 Step -1
If k = 1 Then
Test = Format(Me.SerialNo.Value)
Else
Test = "," & Format(Me.SerialNo.Value) & " "
End If
TestGroup = Test & TestGroup

If k = 1 Then
DoCmd.GoToRecord , , acFirst
Else
DoCmd.GoToRecord , , acPrevious
End If
Next k

strCriteria = "[SerialNo] IN (" & Format(TestGroup) & ")"

DoCmd.OpenReport "TEST", acViewPreview, , strCriteria

End Sub
 
Back
Top