Results 1 to 2 of 2
  1. #1
    xwnoob is offline Advanced Beginner
    Windows Vista Access 2000
    Join Date
    Nov 2011
    Posts
    76

    How to show a record to edit using a non-number field from subform?

    Hi,



    I have a edit section in my database that has a listbox that displays records by clicking on a button. I use the following code to excecute the command:

    DoCmd.OpenForm "Formname", , , _
    "[tblname].[fieldname]=" & "'" & Me.typelistnamehere.Column(0) & "'"
    'Close the dialog box
    DoCmd.Close acForm, "Edit Form"

    THis is a form that has a subform.

    Ok, So the above code only works when i REFER to a fieldname that is a text datatype like "Titlename".I dont why it works that way but it does. Now, this particular main form only has two fields:Both which are number fields "CommitmentID" and "BorrowerID(FK)". The subform has textfields like FacilityName.
    The problem is that i always cant refer to the subform field to OPEN the MAIN FORM. Whenever i do the following code:

    Code:
    DoCmd.OpenForm "AddCommitmentDetail", , , _
            "[tblFacilitySub].[FacilityName]=" & "'" & Me.ListShowCommit.Column(2) & "'"
            'Close the dialog box
            DoCmd.Close acForm, "SelectEditCommitment"
    Access just asks me for the parameter value of facilityname. I think this is because the mainform table is actually tblCommitment and i cant refer to another table that is called tblFacilitySub.This table is the control source of my subform. So any ideas how to solve this? I have done this previously with success but only using text fields....

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    This should help with the syntax for a numeric field:

    BaldyWeb wherecondition
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 06-08-2011, 07:30 AM
  2. Replies: 3
    Last Post: 03-19-2011, 11:04 AM
  3. Show only current record in report from form/subform
    By stelioshania in forum Reports
    Replies: 0
    Last Post: 03-02-2011, 02:19 PM
  4. Replies: 4
    Last Post: 10-29-2008, 11:53 AM
  5. Can I edit a record with a subform?
    By bigmax in forum Forms
    Replies: 0
    Last Post: 08-11-2008, 07:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums