Results 1 to 8 of 8
  1. #1
    sunnyday is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    45

    Finding a record by autonumber in form to edit

    Hi,
    I have a Navigation form inside which resides the Navigation subform and another subform in the Navigationsubform.Now if one wants to edit data by going into their specific ID no which is an auto number how do I do it using a Macro.I have tried using the combo box to search out the ID no,but the subform inside the Navigation form does not appear to edit. The reason being Navigation subform Recordsource is a table which is linked to the table for the subform inside Navigation subform
    I have tried using code but the nos are not coming up to select
    Private Sub cboMtSearch_Click() where cboMtSearch is the control for combo box select

    Dim MyMasterID As Integer
    MyMasterID "Select * from Master where ([MasterID]=" & Me.cboMtSearch & ")"
    Me.NavigationForm.NavigationSubform.Form.RecordSou rce = MyMasterID
    Me.NavigationForm.NavigationSubform.Form.Requery


    End Sub

  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,530
    Based on what you're doing, the variable would need to be declared as String.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    sunnyday is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    45
    I have tried Dim MyMasterID as string , still no numbers show up

  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,530
    And

    MyMasterID = "SELECT...
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    sunnyday is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    45
    I solved it by using a combo box using find a record based on values on this form and place dit in the form header of the Navigationsubform and it seems to work

  6. #6
    sunnyday is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    45
    The new problem is the combo box works in my navigation subform but does not work on other desktops if i try to craete the same combo box following the same procedure as I did on mine. Is it because the users are not admins of the database and are just users? I generally send the db file from my computer via email and they save it to their desktops. As I said the db is a split one. Back end in corporate network drive and front ends in user stations.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    The code above should work for any user, once fixed. What code did you end up with?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    sunnyday is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    45
    Well I used the combo box functionality on the form Header where we can select the values based on values or records available on that form. And the auto nos showed up to select the relevant auto number to find the particular record to edit.
    The macro runs for After Update event as
    Object Type
    Object Name
    Record First
    Where Condition =="[autono]=" & Str(Nz([Screen].[ActiveControl],0))

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

Similar Threads

  1. Replies: 7
    Last Post: 11-23-2013, 07:16 AM
  2. Replies: 21
    Last Post: 08-05-2013, 06:23 AM
  3. finding last record in a table/form
    By clue74 in forum Access
    Replies: 3
    Last Post: 07-19-2012, 06:46 AM
  4. Find A Record on a Certain form to edit
    By donnan33 in forum Access
    Replies: 1
    Last Post: 02-29-2012, 02:08 PM
  5. Edit record in form with original entry shown
    By erknoebe in forum Access
    Replies: 5
    Last Post: 09-29-2010, 02:33 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