Results 1 to 4 of 4
  1. #1
    cowboy is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    291

    data type mis match

    I am getting a Compile error: Type-declaration character does not match declared data type


    Private Sub optMH1_Click()
    Call SelectMHform(1)
    End Sub



    Sub SelectMHform(a As Integer)
    With Forms("BaseForm")
    .optMH& a&.value = 1
    .txtPicture.value = "MH" + Str(a)
    .cmbBoxMaterial.value = ""
    .txtBoxLength.value = ""
    End With
    End Sub

    I tried some other things too but I am still getting an error due to .optMH& a&.value = 1 How do I use a variable in this situation?

  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,521
    Untested, but try this if I understand what you want:

    .Controls("optMH" & a).value
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    cowboy is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    291
    worked beautifully

  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,521
    Glad to hear it.
    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. Unstack Data and Match with Unique ID
    By lukejones in forum Queries
    Replies: 7
    Last Post: 02-24-2014, 08:33 AM
  2. Attachment data type INSERT INTO not working
    By LouisLouis in forum Programming
    Replies: 0
    Last Post: 09-27-2009, 02:23 PM
  3. Number data type
    By BernardKane in forum Access
    Replies: 1
    Last Post: 11-11-2006, 08:19 PM
  4. Finding data that doesn't match
    By dlhayes in forum Queries
    Replies: 1
    Last Post: 11-11-2006, 08:14 PM
  5. query for data type number
    By oracle in forum Queries
    Replies: 1
    Last Post: 12-14-2005, 03:35 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