Refreshing main form from the subform

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

On my main form I have fields displaying:
ticket #,
group name ticket is assigned to
phone number for support group (if I don’t have a phone
number I am not displaying field for phone number.)

I am getting support group name using combo box and populating phone numbers
using querry from a different table

On same form I also have a subform on which I am displaying only open
tickets (ticket #; group name and description.)

After clicking on the ticket in a subform ticket is populated into fields in
a
main form, however in addition I would like to populate fields for a phone
number or make them invisible when there is no phone number.

Here is a code I am using:

Private Sub Form_DblClick(Cancel As Integer)
Dim lngTicket As Long

lngTicket = Me.[Ticket #]
Me.Parent.Requery

Me.Parent.Recordset.FindFirst "[Ticket #]=" & lngTicket
Forms![Remedy Tickets]![Status].SetFocus
End Sub


I noticed that when I select specific ticket from subform main form is
populated, displaying correct values (however not displaying phone numbers.)
I have to select group name again to display correct phone numbers How I can
display correct phone number right away when selecting specific ticket from a
subform?

Also I noticed that when i select different ticket from a subform phone
number doesn't change and is displaying phone number for a previous selection.

Code to display phone numbers:

Private Sub Assigned_To_AfterUpdate()

Dim HasPhone As Variant


HasPhone = Me.lstGroup.Column(1)

If Len(HasPhone & "") = 0 Then
Me.txtPhoneday.Visible = False
Me.txtPhoneNight.Visible = False
Me.txtPhoneday = ""
Me.txtPhoneNight = ""
Else
Me.txtPhoneday.Visible = True
Me.txtPhoneNight.Visible = True
Me.txtPhoneday = HasPhone
Me.txtPhoneNight = Me.lstGroup.Column(2)

End If
Thanks
 
Greg said:
On my main form I have fields displaying:
ticket #,
group name ticket is assigned to
phone number for support group (if I don’t have a phone
number I am not displaying field for phone number.)

I am getting support group name using combo box and populating phone
numbers
using querry from a different table

On same form I also have a subform on which I am displaying only open
tickets (ticket #; group name and description.)

After clicking on the ticket in a subform ticket is populated into fields
in
a
main form, however in addition I would like to populate fields for a phone
number or make them invisible when there is no phone number.

Here is a code I am using:

Private Sub Form_DblClick(Cancel As Integer)
Dim lngTicket As Long

lngTicket = Me.[Ticket #]
Me.Parent.Requery

Me.Parent.Recordset.FindFirst "[Ticket #]=" & lngTicket
Forms![Remedy Tickets]![Status].SetFocus
End Sub


I noticed that when I select specific ticket from subform main form is
populated, displaying correct values (however not displaying phone
numbers.)
I have to select group name again to display correct phone numbers How I
can
display correct phone number right away when selecting specific ticket
from a
subform?

Also I noticed that when i select different ticket from a subform phone
number doesn't change and is displaying phone number for a previous
selection.

Code to display phone numbers:

Private Sub Assigned_To_AfterUpdate()

Dim HasPhone As Variant


HasPhone = Me.lstGroup.Column(1)

If Len(HasPhone & "") = 0 Then
Me.txtPhoneday.Visible = False
Me.txtPhoneNight.Visible = False
Me.txtPhoneday = ""
Me.txtPhoneNight = ""
Else
Me.txtPhoneday.Visible = True
Me.txtPhoneNight.Visible = True
Me.txtPhoneday = HasPhone
Me.txtPhoneNight = Me.lstGroup.Column(2)

End If
Thanks
 
Back
Top