Question : OpenForm with where clause not working

I have the following code following the instructions on some forums here as well as most other MS forums and Access forums.  But my code still doesn't open to the corresponding record.

I run this code and I am prompted with the value of Me.FK_INVOICENBR.  INVOICE_NBR is a bound control on the new form and I want to pass the key from the button's parent form. Any ideas?

DoCmd.OpenForm "FRM_INVOICE_MANAGEMENT", acNormal, , "INVOICE_NBR = " & Me.FK_INVOICENBR

Answer : OpenForm with where clause not working

If [INVOICE_NBR] is numeric ... try this:

    DoCmd.OpenForm "FRM_INVOICE_MANAGEMENT", acNormal, , "[INVOICE_NBR] = " & Me("FK_INVOICENBR")

IF Text ... try this:
   
    DoCmd.OpenForm "FRM_INVOICE_MANAGEMENT", acNormal, , "[INVOICE_NBR] = " & Chr(34) & Me("FK_INVOICENBR") & Chr(34)

mx
Random Solutions  
 
programming4us programming4us