Results 1 to 4 of 4
  1. #1
    lysedi is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Posts
    8

    Button that opens specific record in form view

    Basically I have a report that I want to put a button in the detials section (so that it shows up on every line(record) and when clicked will open my input form with the selected record(same line as button)

    something like, in the onClick() event

    DoCmd.OpenForm "Customer Form", , , "[ID]=" & Me!Text19

    the control source of text19 is the Customer_Name field in the details section and it displays the customer name of each record like i want, but the button wont open, i get an error:

    Run-time error '3075'



    Syntax error (missing operator) in query expression '[ID]=Mon Neopaney'

    mon neopaney being the value of text19, derived from Customer_name

    I dont know what it is that I'm missing, any help would be greatly appreciated

  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,518
    See here for the syntax adjustment required for a text field:

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    lysedi is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Posts
    8
    I figured it out, I didnt add the ID field, once I did that and changed the code it opened the selected record.

    DoCmd.OpenForm "Customer Form", , , "[CustomerID] = " & Me!CustomerID

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Glad you got it sorted out, and welcome to the site by the way.
    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. Form opens table in datasheet view
    By franklbl in forum Forms
    Replies: 9
    Last Post: 03-23-2011, 09:43 PM
  2. Replies: 5
    Last Post: 03-03-2011, 03:56 PM
  3. Computer1 Form Current Record opens on Computer2
    By joefonseca79 in forum Forms
    Replies: 2
    Last Post: 02-20-2011, 04:11 AM
  4. Replies: 3
    Last Post: 01-14-2010, 08:32 AM
  5. Form opens differently from control button
    By bdaniel in forum Programming
    Replies: 5
    Last Post: 12-29-2009, 12:38 PM

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