Results 1 to 5 of 5
  1. #1
    KenThompson is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    11

    Can't find what I broke


    Hello All,
    I have a search form on my db with two searches. One works fine, the 'between date' search, however, I seem to have broken. My live db works fine, but I've made a copy in order to standardize the buttons and now that my buttons are standardized I was running through everything before copying it back to live and found this problem.
    It works by setting a username, start date, and end date. Click search which runs this code:
    Code:
    Private Sub Date_Search_Click()
    DoCmd.OpenForm "Search Project Query Res", acNormal
    DoCmd.Close acForm, "SelectProject", acSaveYes
    End Sub
    Form 'Search Project Query Res' has a query as a record source, which has a few fields, and criteria on a date field with a between statement.

    What is happening is the enddate field doesn't seem to be making it through suddenly. The results form has this code:

    Code:
    Private Sub Form_Load()
    Dim ProgNumb As Variant
    Dim rsTemp As New ADODB.Recordset
        ProgNumb = [Forms]![SelectProject]![cntrlProg]
        rsTemp.Open "SELECT [txtEmpLastName] as LName, [txtEmpFirstName] as FName FROM tblEmployee Where [pkID] =" & ProgNumb & " ;", _
            CurrentProject.Connection, adOpenStatic, adLockReadOnly
      Me.NameBox = rsTemp("FName") & " " & rsTemp("LName")
      Me.SDate = [Forms]![SelectProject]![SDate]
      Me.EDate = [Forms]![SelectProject]![EDate]
      If Me.SearchRes.ListCount = 0 Then
      Me.Label13.Caption = "No Records found for "
      Me.Label13.Width = 2016
      Me.NameBox.Left = 2580
      Me.btnClose.Visible = True
      Me.btnTry.Visible = True
      End If
    End Sub
    And so the results form displays with no reuslts and NO END DATE. I put a msgbox in to show the [Forms]![SelectProject]![EDate] and it errors out with a null. I have looked thoroughly at [SelectProject]![EDate], flipping back and forth between properties for it and SDate and can find no differences.

    Can anyone give any pointers at where I might look to find the problem?

    Thanks,
    Ken

  2. #2
    KenThompson is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    11

    Update

    Ok, I haven't been able to find anything and have gotten no responses so I decided to make a new copy and start over. This time I started with the offending form. Ran the straight copy and ran it after every change until it broke again.
    So my 'button standardization process' is
    1. Create a label
    2. Type same caption on 'label button' as was on button being replaced.
    3. Set Format properties (height, SFX, Text Align) to be same as all the other 'label buttons' I'm creating
    4. Copy 'replaced button's' Name value from other Tab
    5. Add "2" to end of 'replaced button's' Name value
    6. Paste Name from 'replaced button' into new 'label button's' Name value
    7. Change 'label button's' On Click event to [Event Procedure]
    8. Click on ellipses to verify cursor goes to pre existing 'replaced button's' function
    9. Delete 'replaced button'
    10. Move new 'label button' into proper position
    So, I ran it between each step and it worked until I deleted the Button (step 9). I've doen this with about 20 to 30 other buttons in the app and they all work fine.

    So, any ideas now on what the problem is?

    Thanks
    Ken

  3. #3
    Join Date
    Apr 2011
    Posts
    18
    After step 9, have you tried to repeat step 8?

    Does the code still run? Have you tried stepping through it?

  4. #4
    KenThompson is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    11
    Yes, the new 'label button' On Click event still points to the code, the code still runs. It's just that the EDate is not getting thru... apparently not even to the query that is the record source for the next form. Since the "If Me.SearchRes.ListCount = 0 Then" gets hit. I'm assuming that the lack of an EDate in the called form's code (called form puts it on the screen) is indicative of a lack of an EDate in the query (since the query is returning no result). I don't know how to see what is going on in the query, is there something like a breakpoint for a query?

    To answer your question succinctly, yes, I've gone through the same step and everything seems to work the same, there is just no value for EDate.

  5. #5
    KenThompson is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    11

    Update:

    If I use the same process to revert back to a button (on the same copy of the form where a button has been completely replaced by a 'label button' and functionality is gone)... i.e. just create a button, change name of 'label button', name button corresponding to VBA sub, point ON Click event to proc.... the button works as expected. (expected being all dates get thru to called form, query generates results)
    I guess I have to start with a new copy though, as when I try to switch the functionality back to the 'label button' (expecting it to work since it now has a working button... mmm, (nearby?) and it works before deleting the original button) so I can invisible-ize the button... it still doesn't work.
    Either I've inadvertantly initialized the Malicious Evil Access Object or Mr. Mxyzptlk has entered the scene.

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

Similar Threads

  1. I broke my database when i split it.
    By timmy in forum Access
    Replies: 3
    Last Post: 03-16-2011, 12:29 PM
  2. Find a SUM
    By jcsports31 in forum Access
    Replies: 8
    Last Post: 09-14-2010, 10:07 AM
  3. Upgarded access now all forms broke
    By FFPantry in forum Forms
    Replies: 7
    Last Post: 08-24-2010, 12:08 PM
  4. I just gone broke it
    By onechriswhite in forum Access
    Replies: 2
    Last Post: 08-23-2010, 05:06 PM
  5. Find tables
    By Jaime in forum Access
    Replies: 2
    Last Post: 11-04-2009, 01:52 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