Last Form to have Focus error

I

Ivan Grozney

I have an app where the user wants to copy the current record (2 tables) and
create a new record. Since there is a ton of available data I pop up a
screen that allows them to select what parts of the record they want. Works
pretty well (cannot seem to get the calling form to go to the new record).

This copy form can be called from two different forms. So I was trying to
use the following so I would know which form called it as to make some
decisions.

In the same database I am using this code when calling my own type of
message box (ex 1) and it works great. I use it to change the background
color and other stuff.

I tried to use it again on a different form and I get a "Type Mismatch" and
don't understand why. The second one can be called from a simple form or
called from a sub form on a tabbed main form. It fails either way...

************ Ex 1 this one works!*************
Option Compare Database
Option Explicit
Dim frmprevious As Form

Private Sub Form_Open(Cancel As Integer)

Set frmprevious = Screen.ActiveForm

Me.lblTop.Caption = "No Work Orders Matched Restrictions"
If frmprevious = "frmSupSWSR" Then


******************************************************



************ Ex 2 this one gets Type Mismatch!*************

Option Compare Database
Option Explicit
Dim frmprevious As Form

Private Sub Form_Open(Cancel As Integer)

Set frmprevious = Screen.ActiveForm

If frmprevious = "frmSupSWSR" Then


******************************************************

tia,

Vanya
 
I

Ivan Grozney

D'OH! I don't know why the first one worked (ex 2) but if I would remember
to put in the .name with the frmprevious it does seem to work better. Sigh...
 

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