Reset sub form to data entry

Posted on 2005-04-22
Last Modified: 2008-01-09
I need to reset the record source... The following are my code;

Private Sub cmdOpenEditHourForm_Click()
On Error GoTo Err_cmdOpenEditHourForm_Click

        Dim dmfSql As String
        Dim cmboSql As String
        'Me.FormHeader.BackColor = 32768
        Me.Detail.BackColor = -2147483633
        Me.Label102.Visible = False
        Me.Label103.Visible = False
    dmfSql = " SELECT tblEmployee.ClockNo, tblEmployee.Lname, tblEmployee.Fname, " _
        & " [lname] & "" "" & [fname] AS FullName, tblEmployee.Dept, tblEmployee.Supervisor, " _
        & " tblEmployee.SupEmail, tblEmployee.Resv1, tblEmployee.Resv2, tblEmployee.Resv3, " _
        & " tblEmployee.Resv4, tblEmployee.Active " _
        & " FROM tblEmployee " _
        & " WHERE (((tblEmployee.Dept)=""21"") AND ((tblEmployee.Active)=0)) " _
        & " ORDER BY tblEmployee.Lname, tblEmployee.Fname; "

    cmboSql = "SELECT [Lname] & "" "" & [fname] AS SeaarchName " _
        & " FROM tblEmployee " _
        & " WHERE (((tblEmployee.Dept)=""21"") AND ((tblEmployee.Active)=0)) " _
        & " ORDER BY [Lname] & "" "" & [fname]; "
        '''Change main form record source
        Me.RecordSource = dmfSql
        '''Change combo box back to original
        Me.Combo10.RowSource = cmboSql
        ''Disable subform to data entry
        Me.subformlLaborHour.Form.DataEntry = True
        Me.subformtblAttendance.Form.DataEntry = True
    Exit Sub

    MsgBox Err.Description
    Resume Exit_cmdOpenEditHourForm_Click
End Sub

When I click on the button, the two subforms DataEntry does not return back to data entry.

Any idea??

Question by:perennial
    LVL 16

    Accepted Solution

    try me.subform!laborhour.form.requery
    LVL 1

    Author Comment

    did you mean...

    LVL 16

    Expert Comment

    yes that's what I meant
    LVL 1

    Author Comment

    I found what I did wrong...thanks for trying to help.
    LVL 16

    Expert Comment

    Hi, ty, but if you I didn't help solve your problem please help others by posting your own solution.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now