Re: Double Click Field Conflicts
- From: "Carl Rapson" <mr.mxyzptlk@xxxxxxxxxxxxxxxxx>
- Date: Fri, 19 Oct 2007 09:14:36 -0500
"ServiceEnvoy" <serviceenvoy@xxxxxxxxx> wrote in message
news:1192763918.956195.86350@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Oct 12, 9:22 am, "Carl Rapson" <mr.mxyzp...@xxxxxxxxxxxxxxxxx>
wrote:
"ServiceEnvoy" <serviceen...@xxxxxxxxx> wrote in message
news:1192196250.840735.229760@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am using the following double click event to open another form to
the record that matches the product id to the item number. The
problem is that the item number sometimes has characters that confuse
the double click event. How do I preserve the event and isolate the
item number so it doesn't hurt the code of the event?
Private Sub PartNumber_DblClick(Cancel As Integer)
If IsNull(Me.PartNumber) Then
DoCmd.OpenForm "FRM_Inventory", , , , acFormAdd
Else
DoCmd.OpenForm "FRM_Inventory", , , "ItemNumber=" &
Me.PartNumber
End If
End Sub
What do you mean by "sometimes has characters that confuse the double
click
event"? Can you give an example?
Carl Rapson
Sometimes the "itemnumber" will have characters like "-" or "/" or
blank spaces. That seems to mess up the formula. If it was just a
standard number (12345) it doesn't cause any problems.
If your item number is a text value instead of numeric, you'll need to put
quotes around it in the Where clause:
"ItemNumber='" & Me.PartNumber & "'"
The same thing exaggerated for clarity:
"ItemNumber= ' " & Me.PartNumber & " ' "
If there's a chance that the item number could also contain a single quote,
you'll need to use Replace to "double-up" the single quotes:
"ItemNumber='" & Replace(Me.PartNumber,"'","''") & "'"
Again, exaggerated for clarity:
"ItemNumber= ' " & Replace(Me.PartNumber," ' "," ' ' ") & " ' "
Carl Rapson
.
- Follow-Ups:
- Re: Double Click Field Conflicts
- From: ServiceEnvoy
- Re: Double Click Field Conflicts
- References:
- Double Click Field Conflicts
- From: ServiceEnvoy
- Re: Double Click Field Conflicts
- From: Carl Rapson
- Re: Double Click Field Conflicts
- From: ServiceEnvoy
- Double Click Field Conflicts
- Prev by Date: More than 1 timer?
- Next by Date: Re: Returning to previous record on Scrolling form
- Previous by thread: Re: Double Click Field Conflicts
- Next by thread: Re: Double Click Field Conflicts
- Index(es):
Relevant Pages
|