Results 1 to 4 of 4
  1. #1
    RLehrbass is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    102

    getting error, wrong datatype for one of my arguments?

    I am correcting some functionality on a few forms, but I keep getting this error on two of them:


    "The expression you entered is the wrong data type for one of your arguments."

    I have a subform in the form and need to requery the subform to update the info displayed when i click the 'add to list' button on the form. this is working correctly on two other forms but not these two??? copy and past the code and I just changed the subform name.

    Here is the simple code:

    Private Sub cmdAddToList_Click()
    On Error GoTo Err_cmdAddToList_Click

    DoCmd.Requery (frmMemberTypeSubform)
    DoCmd.GoToRecord , , acNewRec

    Exit_cmdAddToList_Click:
    Exit Sub

    Err_cmdAddToList_Click:
    MsgBox Err.Description
    Resume Exit_cmdAddToList_Click

    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,518
    The form name needs to be quotes unless that's a variable.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    RLehrbass is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    102
    Thank You,
    I also had to reverse the order of the requery and acNewRec. it now works correctly.

  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,518
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Datatype error in criterion selection
    By Mahendra1000 in forum Access
    Replies: 12
    Last Post: 07-21-2015, 05:55 AM
  2. Criteria datatype error???
    By GraeagleBill in forum Programming
    Replies: 12
    Last Post: 05-04-2015, 11:01 AM
  3. Replies: 3
    Last Post: 02-12-2014, 03:36 PM
  4. DLookUp DataType Mismatch Error
    By theosgood in forum Programming
    Replies: 2
    Last Post: 10-29-2013, 10:04 AM
  5. confusing datatype error issue
    By TheShabz in forum Queries
    Replies: 5
    Last Post: 10-11-2010, 05:14 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