Choose in wich order selected records will be set on report

B

Bengt Silfverling

From a Access database form I want to select records, by checking
checkboxes, and then have the possibility to choose another order for
the selected records to have them set on a report for printing. How to
get the records in the order I want?

Anyone has a method for this?

/Bengt Silfverling
 
A

Allen Browne

If you want the report to print the records in the order you selected them,
you will need to record that order somewhere.

You could do that by adding a field of type Number. Then use the
BeforeUpdate event of the form to compare the OldValue of the check box to
the Value, and if it changed, set the number field. You can then sort the
report by the number field.

This example assumed a yes/no field named IsPicked, and a Number field named
SortOrder, in a table named Table1:

Private Sub Form_BeforeUpdate(Cancel As Integer)
With Me.IsPicked
If .Value = .OldValue Then
'do nothing: nothing changed.
Else
If .Value Then 'Get the next available number.
Me.SortOrder = Nz(DMax("SortOrder", "Table1"),0) + 1
Else 'It was unpicked: clear the number.
Me.SortOrder = Null
End If
End If
End With
End Sub


If you have multiple users all selecting values simultanesously, you will
need to add a local table, and use Form_BeforeUpdate to execute an
Append/Delete query statement. The local table will contain just two fields:
the primary key value and the sort order. The report will inner join this
table to the main one for the report.
 
B

Bengt Silfverling

G´day Allen! Great. Thanks a lot.

I will try Your solution. Think it is just what I need...

And yes, there will be multiple users. Probably they will use the
database simultaneously so the notes about that I am pleased You gave
me.

Yet I don´t exactly know the users/customers expectations and how they
want the project/database to behave. They are mainly my brother and
some of his colleagues. I don´t think they are really sure themselves
about what they want from the project. So I have to guess and try, and
then present a solution/project as optimated as possible. After my
intentions. To see if they can use it...

I guess a good solution is that the users can open a switchboard("as
little contact with inner Access as possible") and select a form to
write new records or choose the order of records to be printed on a
report. I dont´t think the presumtive users have so good skills in
using databases, so " As easy and automated as possible" will
certainly be best. Just user-friendly...

I know the users want to reach and work with the database via
webbrowser. I haven´t tried Access Pages yet. But somewhere here in
the groups I read something about that Pages wasn´t good for the task.
And I have a friend here that is developer in ASP. He says that the
best solution is to build an interface with ASP to reach the
databasefunctions from Internet. Maybe it is worth little money to get
an ASP-script if not Access Pages is something to build on. Opinion?

Yesterday I printed a packet of papers from these groups(found Your
site too..). Questions and their answers from MVP´s and others give
very good knowledge and problem-solutions. Will sit down and read the
packet for a while now...

Any tip about good litterature for programming Access with macros and
VBA?

/Bengt Silfverling
P.S. My brother got a lot of help from Toolbook-Jackson in Port
Macquarie and now I got a quick answer and help from You. Seems that
we here "UpOwer", Sweden, get the best help with our computer-problems
from You friendly guys from "DownUnder". And then You have "'Flying
Doctors' Sister Kate..." Good continent that "DownThere.."...
 

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