Results 1 to 2 of 2
  1. #1
    cmcquain is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Posts
    1

    Access wil not allow me to navigate between records


    Help please. I have put some VBA code into my database to link and text boxes to different tables. The code works, but once I enter a Tracking Number that finds a NABP number I am unable to go to a dofferent record or save. I also want to edit the fields so I am unable to use a query since you cannnot edit queries. Here is the sample of my code.

    Code:
    Private Sub Form_AfterUpdate()
    On Error Resume Next
        Dim db As Database
        Dim rs As Recordset
        Dim ctl As Control
        If Me.[Nature Investigation] = 1 Then
            Set db = CurrentDb
            Set rs = db.OpenRecordset("SELECT * " & _
                                        "FROM Feedback " & _
                                        "WHERE [NABP] = '" & Me.[Tracking Number] & "' ")
            
            Me.[Request Title] = rs![PharmName]
           ' Me.[OptCaseSent] = 1
            Me.[Date Received/Sent] = rs![Sent to CFI]
            Me.[Requester Name] = 3
            Me.[Request Type] = 2
            
            rs.Close
            Set rs = Nothing
            Set db = Nothing
            
        End If
        
    End Sub
    Help would be wonderful. This is driving me nuts.

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    "You cannot edit queries"?

    First, let me welcome you to the forum. Access is big and wide and deep, and a great tool once you learn the basics. It's an even better tool when you learn some of the cool bells and whistles.

    This one's basic.

    You CAN edit most queries, and they are the standard way of updating data. You link the form and its controls to an appropriate query, and all the details of updating are handled automatically.

    So, create the query that has the information you need, put that query as the form's record source, and link each field on the form to the underlying field on the query. That handles most of it. (If you create the query, then select the query in the nv pane and then on the create tab click the the form creation wizard and the wizard will set up a lot of that automatically.)

    If you want to limit the query by a filter to certain records, or if you want to use an unbound field to help position the query to a particular record, then you can put an unbound selector control or text box on the header of the form, and use the AfterUpdate event of the control to set the filter value, or to establish the position on the query by using VBA to set a bookmark.

    Here's Allen Browne's exception list of what kinds of queries CANNOT be updated. http://allenbrowne.com/ser-61.html

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

Similar Threads

  1. navigate records on the form is slow
    By masoud_sedighy in forum Forms
    Replies: 3
    Last Post: 09-28-2013, 01:32 PM
  2. Replies: 9
    Last Post: 08-07-2012, 11:50 AM
  3. Buttons on form to navigate through records
    By emilyrogers in forum Forms
    Replies: 2
    Last Post: 07-19-2011, 10:17 AM
  4. VBA to Navigate form
    By asmith in forum Access
    Replies: 3
    Last Post: 09-30-2010, 11:37 AM
  5. Replies: 2
    Last Post: 03-25-2010, 12:11 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