Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 forms, same field in each, different value returned when dbl clicked

Status
Not open for further replies.

freespiritcherishes

Technical User
Oct 17, 2003
42
0
0
GB
Hi,

not sure how hard this is to do.

Scenari Form A and Form B both with same field CDID

If i dbl click FormA CDID i get msgbox "Hello"
If I dbl click FormB CDID i get msgbox "Hello"

what code would i need in order to get

FormA dble click CDID to get msgbox "Hello" but on
FormB dble click CDID to get msgbox "Hello World"


In other words, change the ondbleclick event source code from within my current form B. But when i am in Form A, for it to retain its original code. Is this possible? Anyone know?

freespirit
 
For a simple answer, the dblclick event in form B would contain the code to change it's textbox value. So, it would have something like this:

Code:
me.textbox.text = me.textbox.text & " World"

 
Hi Hneal98,

Sorry, I haven't made myself sufficiently clear. Let me try again.. sorry

3 Forms. Form A, Form B, MySubform

"MySubform" has a field called CDID. When dble clicked, it gives msg "Hello". Naturally whatever main form it is embedded into, when I doubleclick that field in the subform, it will say "hello".

However, I want this subform in both Forms A and B but in Form B, to give msg "Hello World" instead. Is this possible?

freespirit
 
Hi Hneal98,

sorted. If your interested here is the code:

If Me.Parent.Name = "FormA" Then
Msgbox "Hello"


ElseIf Me.Parent.Name = "FormB" Then

Msgbox "Hello World"

End If
 
Hi hneal98

on the onclick/ondblclick event of any object in the form.

I have a field called CDID (Contact Diary ID), if i dble click it, it opens the Diary note form of that no.

As both my subforms were in the same Main form i had to call it independently but relative to the main they are in. Does that make any sense?

freespirit

 
I must be missing something becuase if all you want to do is put hello in the dbl click event of formA.textboxA and hello world in the dbl click event of formB.textboxB then you just put a message box in each with the message you want each to display. You don't need an 'if' statement for that.

Let me know if there is something missing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top