Pop Up Form

F

Frustrated

I'm writing an application that tracks change management
requests. What I am trying to do is have a start up form
pop up and advise how many requests are pending approval.
Its a simple form that has a label, a text box that
displays the results of a query, and a command button
that closes the form and opens the main switchboard. I'm
setting the focus to the command button on the forms On
Open event.

The form works as advertised as long as there are
requests pending, but if there are none, it errors out
with the run time error '2105' "You can't go to the
specified record." Opening the debugger shows its
erroring out on the DoCmd.GoToControl "cmdClose" line.

The preferable method would be to display this
information in a dialog box, but that's way beyond me.
Any suggestions on the form, or how to only make it
appear if there are records requiring approval, would be
greatly appreciated.
 
F

Frustrated

Thanks for the response. I tried that, and it errored out
on that line.

I believe the problem lies with the query returning a
Null value, causing the "You can't go to thepermutation of an IIf and Nz statement I can think of,
but still can't get anything returned when the query runs
returning no records.

Thanks again, and any advice would be hugely appreciated.
 
P

PC Datasheet

Post your code in the Open event and we can all take a look at it.

Steve
PC datasheet
 
F

Frustrated

Already did. All there was was the
DoCmd.GoToControl "cmdClose".

Also tried it with your suggestion, Me!CmdClose.SetFocus.

I've just abandoned that form for now. Its functionality
I can add later.

I just need to learn how to convert a null value in a
query result to a zero.

Thanks anyway.
 
F

Frustrated

OK Guys, how do I do this?

The pop up form has one text box on it bound to this
query:
SELECT Count(tblRequests.RequestID) AS CountOfRequestID,
tblRequests.Approve, tblRequests.Deferred
FROM tblRequests
GROUP BY tblRequests.Approve, tblRequests.Deferred
HAVING (((tblRequests.Approve)=No) AND
((tblRequests.Deferred)=No));

I'm trying to get the count to populate the box. However,
if there are no pending requests, the query returns
nothing, and the form comes up blank. No label, no
textbox, nothing.

I've tried permutations of IIfs and Nzs to get a zero in
the count field rather than having it come up null,
written expressions that tried to do the same, all with
the same disappointing results.

Any ideas? I'm also going to post in the query ng to see
if they can tell me how.

Thanks
 

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