Results 1 to 2 of 2
  1. #1
    Armitage2k is offline Novice
    Windows 7 Access 2007
    Join Date
    Apr 2010
    Posts
    4

    open form - display specific record but also all other recordsets

    Hey.
    I am having trouble with this piece of VBA:
    Code:
    Dim strWhere As String
    Dim rs As DAO.Recordset
    strWhere = "[ClientID] = '" & Me.[ClientID] & "'"
    DoCmd.OpenForm "Client Details"
    With [Forms]![Client Details]
    Set rs = .RecordsetClone
    rs.FindFirst strWhere
    If rs.NoMatch Then
    MsgBox "Not found"
    Else
    .Bookmark = rs.Bookmark
    End If
    End With
    Set rs = Nothing
    I am trying to open a form called Client Details, when I have clicked on the unique ClientID, which is displayed in another form.


    So basically, once I click on the ID, the Client Details form opens, showing me the clicked entries details, BUT I also want to be able to page through the other clients details. This code is fixing this issue for another form with exactly the same basis (employees instead of clients), but refuses to work for the clients, giving me a type mismatch in criteria expression error.

    Any ideas what could be wrong in my table? It works perfectly for the employee table which is 99% the same thing, only different data.

    Thanks,
    A2k

  2. #2
    Armitage2k is offline Novice
    Windows 7 Access 2007
    Join Date
    Apr 2010
    Posts
    4
    I found it myself.

    The difference between those 2 tables is that one ID field is a numeric value, hence does not need the " ' " in the code. this one works fine now:
    Code:
    strWhere = "[ClientID] =" & Me.[ClientID]
    cheers,
    A2k

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

Similar Threads

  1. Open form which creates new record
    By mjhopler in forum Forms
    Replies: 7
    Last Post: 02-09-2010, 01:37 PM
  2. Print a specific record report from a form
    By cynthiacorley in forum Reports
    Replies: 27
    Last Post: 02-08-2010, 06:34 AM
  3. Replies: 3
    Last Post: 01-14-2010, 08:32 AM
  4. Replies: 7
    Last Post: 11-29-2009, 01:44 PM
  5. Open to specific form
    By ecpike in forum Forms
    Replies: 2
    Last Post: 06-12-2009, 08:32 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