Results 1 to 3 of 3
  1. #1
    dwaterman is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Location
    Elkhart, IN
    Posts
    22

    Form Recalc issues


    I have an Access database that was created in the 2003 version. It is being used by employees with 2003, 2007 and 2010 versions. On my invoice form I have created code to pop up a window to add a part number and description if the part is not in the underlying table. When the pop-up window closes, I want the invoice form to populate the part description field. In order for this to happen, I must recalc the form to update the recordset. I am using Forms!myFormName.Form.Recalc in the close event property on the pop-up to accomplish this. The code fires, but I am getting an error message stating I need 2 parameters. I have checked the proper syntax, and can't figure out what they could possibly looking for. This same code works perfectly in another database I have. I can move the location of the code to various events, and I always get the same error message. It does not matter which version of Access I'm using. I get the same error in each. Does anyone have a clue what I'm looking for?

    Thanks!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What code are you using to launch the PopUp form?

  3. #3
    dwaterman is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Location
    Elkhart, IN
    Posts
    22
    This is my code for opening the pop-up form:

    Private Sub PartNo_AfterUpdate()
    On Error GoTo Err_PartNo_AfterUpdate

    If Not IsNull([txtPartNo]) Then
    [txtPartNo] = CapAll([txtPartNo])
    End If

    'Look up Part #
    Dim rst As ADODB.Recordset
    Dim strSQL As String

    Set rst = New ADODB.Recordset
    strSQL = "SELECT txtPartDesc from tblParts " & "WHERE txtPartNo = """ & Me!txtPartNo & """"
    rst.Open strSQL, CurrentProject.Connection
    If rst.BOF And rst.EOF Then

    Dim mbxResponse As VbMsgBoxResult
    Dim strSQL2 As String

    mbxResponse = MsgBox("Add part # to table?", vbQuestion + vbYesNo)

    If mbxResponse = vbYes Then

    strSQL2 = "INSERT INTO tblParts ([txtPartNo]) " & _
    "VALUES ('" & Me.txtPartNo & "');"

    DoCmd.SetWarnings False
    DoCmd.RunSQL strSQL2
    DoCmd.SetWarnings True

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmParts"

    stLinkCriteria = "[txtPartNo] = " & "'" & Me![txtPartNo] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Else

    Me!txtPartDesc = rst!txtPartDesc
    End If
    End If

    Exit_PartNo_AfterUpdate:
    Exit Sub

    Err_PartNo_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_PartNo_AfterUpdate

    End Sub

    Do I need to explicitly close the recordsets? I tried that, but it didn't solve this issue. I also put the recalc code in the part description field I want to populate. This made no difference. I still got the error message.

    Thanks for your time!

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

Similar Threads

  1. Button and form Issues
    By rmohebian in forum Access
    Replies: 1
    Last Post: 03-01-2012, 06:23 PM
  2. Form SubForm Issues still
    By kathi2005 in forum Forms
    Replies: 4
    Last Post: 11-07-2011, 01:10 PM
  3. 2 issues with my form
    By Grek in forum Forms
    Replies: 6
    Last Post: 11-05-2011, 11:43 AM
  4. Issues with Continues form
    By ducecoop in forum Access
    Replies: 3
    Last Post: 11-11-2010, 01:18 PM
  5. Help with multiple form issues
    By AKQTS in forum Forms
    Replies: 0
    Last Post: 08-18-2010, 07:57 AM

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