Two way communication between forms. No tables.

  • Thread starter Thread starter Ynot
  • Start date Start date
Y

Ynot

I need to make a generic "override form." It will be used anywhere someone
has to deviate from normal procedures.



I want it to work like a message box but I need to be able to pass two
values, a message, and a "password" for the particular level. When a
response is entered I want to pass back pass/fail or the response so I can
check it.



I keep coming up short on ideas and played all day trying to get something
to work.



Please make me look stupid and show me what I'm Missing!!!!!
 
I need to make a generic "override form." It will be used anywhere someone
has to deviate from normal procedures.

I want it to work like a message box but I need to be able to pass two
values, a message, and a "password" for the particular level. When a
response is entered I want to pass back pass/fail or the response so I can
check it.

I keep coming up short on ideas and played all day trying to get something
to work.

Please make me look stupid and show me what I'm Missing!!!!!

You can pass the message and the password using the openform OpenArgs
argument.
The second form reads the message and if the password is correct,
displays the message in the LabelName label control.

From Form1:
Docmd.OpenForm "Form2", , , , , ,"This is your Message/ThePAssWoRd$*"

In the Form2 Load event:

If Not IsNull(Me.OpenArgs) Then
Dim strMessage as String
Dim strPassword as String
strMessage = Left(Me.OpenArgs,InStr(Me.OpenArgs,"/")-1)
strPassword = Mid(Me.OpenArgs,InStr(Me.OpenArgs,"/")+1)
If strPassword = InputBox("Enter the Password") Then
Me.LabelName.Caption = strMessage
Else
MsgBox "You don't have authority to view this form."
DoCmd.Close acForm, Me.Name
End If
End If

You can use the same method to pass back to Form1 any information you
wish.

You might want to consider another unbound form to use in place of the
InputBox so that you can use an unbound control with a Password Input
Mask to hide the entered password.
 
OK, I understand that part and use the parse the OpenArgs but how do I pas
back pass/fail???
 
Back
Top