Dbl Click to open another form to a specific record

  • Thread starter Thread starter serviceenvoy
  • Start date Start date
S

serviceenvoy

I would like to be able to double click on the field "ServiceCenter"
in a form called "Service_Call_Tracking" and open another form called
"Service_Centers" and have it display the record whose field
"ServiceCenter" matches the "ServiceCenter" field in the
"Service_Call_Tracking" database.

Further Information: The form Service_Call_Tracking has a drop down
list field called "ServiceCenters" that displays all the Service
Centers Names listed in our "Service_Centers" Form.

I am a novice so please help me understand as well as help me figure
out the VBA code I need to create to make this happen.
 
I would like to be able to double click on the field "ServiceCenter"
in a form called "Service_Call_Tracking" and open another form called
"Service_Centers" and have it display the record whose field
"ServiceCenter" matches the "ServiceCenter" field in the
"Service_Call_Tracking" database.

Further Information: The form Service_Call_Tracking has a drop down
list field called "ServiceCenters" that displays all the Service
Centers Names listed in our "Service_Centers" Form.

I am a novice so please help me understand as well as help me figure
out the VBA code I need to create to make this happen.

Look up the OpenForm method in VBA help files.
Also look up:
Where clause + Restrict data to a subset of records.

What datatype is the field [ServiceCenter]? Number? Text?

If it is a Number datatype, then:

DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = " &
Me.[ServiceCenters]

However, if it is a Text datatype, then use:

DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = '" &
Me.[ServiceCenters] & "'"

Remember that the bound column of a combo box may not necessarily be
what you see, so adjust the above code accordingly.
 
Excellent. It works with this string:

Private Sub ServiceCenter_DblClick(Cancel As Integer)
DoCmd.OpenForm "Service_Center", , , "[ServiceCenter] = '" & Me.
[ServiceCenter] & "'"
End Sub

Now, new problem. One of my servicecenter fields has a ' in the field
and fouls up the command. How could we build the command to search
for something like "Bill's TV" without getting stopped by the '
character (or other characters that might be in that field)?


I would like to be able to double click on the field "ServiceCenter"
in a form called "Service_Call_Tracking" and open another form called
"Service_Centers" and have it display the record whose field
"ServiceCenter" matches the "ServiceCenter" field in the
"Service_Call_Tracking" database.
Further Information: The form Service_Call_Tracking has a drop down
list field called "ServiceCenters" that displays all the Service
Centers Names listed in our "Service_Centers" Form.
I am a novice so please help me understand as well as help me figure
out the VBA code I need to create to make this happen.

Look up the OpenForm method in VBA help files.
Also look up:
Where clause + Restrict data to a subset of records.

What datatype is the field [ServiceCenter]? Number? Text?

If it is a Number datatype, then:

DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = " &
Me.[ServiceCenters]

However, if it is a Text datatype, then use:

DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = '" &
Me.[ServiceCenters] & "'"

Remember that the bound column of a combo box may not necessarily be
what you see, so adjust the above code accordingly.
 
Excellent. It works with this string:

Private Sub ServiceCenter_DblClick(Cancel As Integer)
DoCmd.OpenForm "Service_Center", , , "[ServiceCenter] = '" & Me.
[ServiceCenter] & "'"
End Sub

Now, new problem. One of my servicecenter fields has a ' in the field
and fouls up the command. How could we build the command to search
for something like "Bill's TV" without getting stopped by the '
character (or other characters that might be in that field)?

I would like to be able to double click on the field "ServiceCenter"
in a form called "Service_Call_Tracking" and open another form called
"Service_Centers" and have it display the record whose field
"ServiceCenter" matches the "ServiceCenter" field in the
"Service_Call_Tracking" database.
Further Information: The form Service_Call_Tracking has a drop down
list field called "ServiceCenters" that displays all the Service
Centers Names listed in our "Service_Centers" Form.
I am a novice so please help me understand as well as help me figure
out the VBA code I need to create to make this happen.

Look up the OpenForm method in VBA help files.
Also look up:
Where clause + Restrict data to a subset of records.

What datatype is the field [ServiceCenter]? Number? Text?

If it is a Number datatype, then:

DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = " &
Me.[ServiceCenters]

However, if it is a Text datatype, then use:

DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = '" &
Me.[ServiceCenters] & "'"

Remember that the bound column of a combo box may not necessarily be
what you see, so adjust the above code accordingly.

DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = """ &
Me.[ServiceCenters] & """"

Just for clarity, that's:
"[ServiceCenter] = " " " & Me.[ServiceCenters] & " " " "
 
Excellent. It works with this string:
Private Sub ServiceCenter_DblClick(Cancel As Integer)
DoCmd.OpenForm "Service_Center", , , "[ServiceCenter] = '" & Me.
[ServiceCenter] & "'"
End Sub
Now, new problem. One of my servicecenter fields has a ' in the field
and fouls up the command. How could we build the command to search
for something like "Bill's TV" without getting stopped by the '
character (or other characters that might be in that field)?
On 24 Feb 2007 09:43:56 -0800, (e-mail address removed) wrote:
I would like to be able to double click on the field "ServiceCenter"
in a form called "Service_Call_Tracking" and open another form called
"Service_Centers" and have it display the record whose field
"ServiceCenter" matches the "ServiceCenter" field in the
"Service_Call_Tracking" database.
Further Information: The form Service_Call_Tracking has a drop down
list field called "ServiceCenters" that displays all the Service
Centers Names listed in our "Service_Centers" Form.
I am a novice so please help me understand as well as help me figure
out the VBA code I need to create to make this happen.
Look up the OpenForm method in VBA help files.
Also look up:
Where clause + Restrict data to a subset of records.
What datatype is the field [ServiceCenter]? Number? Text?
If it is a Number datatype, then:
DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = " &
Me.[ServiceCenters]
However, if it is a Text datatype, then use:
DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = '" &
Me.[ServiceCenters] & "'"
Remember that the bound column of a combo box may not necessarily be
what you see, so adjust the above code accordingly.

DoCmd.OpenForm "Service_Centers", , , "[ServiceCenter] = """ &
Me.[ServiceCenters] & """"

Just for clarity, that's:
"[ServiceCenter] = " " " & Me.[ServiceCenters] & " " " "

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -

So, this now works perfectly:

Private Sub Service_Center_DblClick(Cancel As Integer)
DoCmd.OpenForm "Service_Center", , , "[ServiceCenter] = """ & Me.
[RepairCenter] & """"
End Sub

Now, on to the next project :)

I would like to see if I can create a function that would display the
same information in a small pop up balloon/window without actually
having to go to the entire record in the other form. It would be nice
to point at the service center with the mouse and a balloon pop up
some basic information like phone number, fax number, email. It would
be helpful if we could perform both functions. This would involve the
exact same forms and only add in the additional fields of phone, fax,
& email from the service_center form.
 
Back
Top