Results 1 to 3 of 3
  1. #1
    aussie92's Avatar
    aussie92 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    18

    form returns records not in record source

    Hello -



    I have a report that shows an itemized list of events and sub events. I have an "edit" button next to each date which pulls up a form to edit that event. The form is built off a query that pulls all events greater than or equal to that event (because if the user edits one event, they need to edit all future events as well).

    The query the form is based on runs fine. It only pulls that date and all future dates, however, when I am in the form, if I hit the next button enough, it goes to the end and then views the entry with todays date. No idea why, esp. because that record does not show when I look at the query. Any ideas?


    code on rpt:

    Code:
    Private Sub edit_record_Click()
        Dim formName As String
        Dim dateSearch
        
        dateSearch = Me.date_to_search.Value
        TempVars("search_date").Value = dateSearch
        
        formName = "edit_actuals"
        DoCmd.OpenForm formName, acNormal
    End Sub
    code on qry:

    Code:
    SELECT data_Workflow_Log.ID AS Workflow_ID, data_Workflow_Log.ID, data_Workflow_Log.Date_Entered, data_Workflow_Log.Agent_Name, data_Workflow_Log.[Ad-Hoc], data_Workflow_Log.Action_Items, data_Workflow_Log.Dependencies, data_Workflow_Log.Risks_Issues
    FROM data_Workflow_Log
    WHERE (((data_Workflow_Log.Date_Entered)>=[tempvars]![search_date]) AND ((data_Workflow_Log.Agent_Name)=fOSUserName()))
    ORDER BY data_Workflow_Log.Date_Entered;
    Again, the query returns correct info, but the form also shows todays record, no matter what. I am assuming it is a form preset so any ideas? It is not set to data entry, and it allows additions, deletions, edits, and filters.

    Thanks for any help!

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    My guess would be that the current date is being used to populate your Form's Date Field when a New Record is opened. That can be done through the OnCurrent event of the Form, checking to see whether the Current Record is a New Record, or through the Default Value Property at the Form-level or Table-level.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    aussie92's Avatar
    aussie92 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    18
    thanks - However, it is not sent to default to anything. Infact, it opens up to the correct record just fine. It isnt until I continue to use the next record button that it brings me back to the current date.

    For example, if I have dates for every day from 1/1/13 to 1/29/13 and I select to view date 1/27/13, it will bring up the 27th, and then I can use the next button to go to the 28th, the 29th, and then it will show the 14th. No idea why....




    Quote Originally Posted by Missinglinq View Post
    My guess would be that the current date is being used to populate your Form's Date Field when a New Record is opened. That can be done through the OnCurrent event of the Form, checking to see whether the Current Record is a New Record, or through the Default Value Property at the Form-level or Table-level.

    Linq ;0)>

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

Similar Threads

  1. Replies: 2
    Last Post: 01-11-2013, 06:51 PM
  2. Record source in form not updating
    By sephiroth2906 in forum Forms
    Replies: 3
    Last Post: 01-27-2012, 03:16 PM
  3. Multiple source records for the Form
    By spellbound in forum Forms
    Replies: 1
    Last Post: 12-28-2011, 10:48 AM
  4. Form Record Source - Best practices.
    By ser01 in forum Forms
    Replies: 1
    Last Post: 06-11-2011, 11:32 AM
  5. Replies: 1
    Last Post: 07-04-2010, 03:31 PM

Tags for this Thread

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