Re: Double Click Field Conflicts



"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


.



Relevant Pages

  • Re: innerHTML = responseText generates invalid chars
    ... Actually the single quote is some sort of backward single quote. ... There are also other characters not displaying correctly after ... content Firefox would display invalid characters using? ... Inside the output file itself: ...
    (comp.lang.javascript)
  • Re: Solaris 9 username longer that 8 characters
    ... I dont want to end up in a cauldron!! ... that format only prints the first 8 characters of a username. ... < This line left intentionally blank to confuse you. ...
    (comp.unix.solaris)
  • Re: Trouble reading fields containing special characters
    ... I double any possible single quote characters in the string. ... Any double single quotes in a string (all SQL strings are enclosed by single ...
    (microsoft.public.vb.database.ado)
  • Re: ~/.bashrc problem
    ... > Using " works most of the time, but, if you encouter some URL like ... However the expansion is done only once; characters inside the variable ... you must enclose it in single quote to prevent expansion of ...
    (Debian-User)
  • Re: SQL Injection Code Help
    ... The most important characters to get rid of are the single quote and ... If your application connects to SQL server with a SQL ... user that is a member of the sysadmin role, SQL injection could be very ... ' Replace globally disallowed characters: ...
    (microsoft.public.sqlserver.security)