## MS-Access query sort not working

Looked around on how to sort out a report properly as it was sorting on the wrong field (actually at first it did not even look like it was sorted at all, but I did not notice that other field was indeed sorted!)

The sort in a Query Report form (opposed to just an SQL query) is defined by the Group & Sort feature and not the SQL results. Actually, you most certainly don't need it in the SQL because otherwise you'll be sorting twice.

It took me a while, but I'm glad I found the solution. All the documentation I searched only talked about the wrong methods: use the Query sort ...

## Check whether a form is open in MS-Access

MS-Access has forms, but no real means to know whether a form exists. It looks like you could go through the list of forms (Forms.item(i)) but I'm not too sure that would work in all circumstances.

Instead, I used code I found on another site which runs a system command to determine whether a form is currently attached to a window (has a state other than zero.)

The code looks like this:

IsLoaded = False
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
End If
End If

The first ...

## Problem

One of my customers changed a report and all of a sudden was getting an empty page for every other page (it will look like the last page in case you print a single page, but it really is every other page.)

## Did you think about the margins?

When you create a report to be printed, you must define its size properly. So if you are printing 8"1/2 x 11" paper, you want to create a report that's exactly (to about 1/100th) the same size.

The total height must be 11" and the total width must be 8"1/2. However, the actual page that you create does NOT include the ...

## MS-Access Report not printing

### Reports, Print and Load() Event

I wrote many forms and in general everything works just fine.

In this case, I wanted to enter the data with a function so I could properly format several of the fields (especially the billing and shipping addresses.) That was done on the Load() event. That function working great when looking at the report from within MS-Access (on screen report). However, when directly sending the report to the printer, it was not working well at all.

[toc hidden:1]

## MS-Access: INSERT INTO syntax error

Today I was creating a report and created a table with a column named 'Group'. It looked like it worked just fine so I moved on with it.

Then, at the point I wanted to insert data with a simple INSERT INTO ... statement, it broke. The statement would generate a syntax error. Yes. The simple answer is that GROUP is viewed as a keyword and thus when used as a field name it needs to be escaped (i.e. written between backward quotes: ...). Not liking the need to escape a field name each time I use it, I just renamed the field which is even better.

## Report Sub-forms & their Recordset

Today I resolved a problem with setting up a sub-form recordset in a report.

In a form, you can do a lot of things, but reports are very much constrained. Most certainly because that way they are more sure that the data won't change while printing the report. But for sure, it is very annoying.

I got this error first:

"This feature is only available in an ADP"

In itself, that error means totally nothing. I have no clue what an ADP is. The solution to that error is available in Microsoft website here:

## Diverse Realty

Want a New Home?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

## Terms of Site Index

Find the page/content you are looking for with our index.