Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    OHIO
    Posts
    75

    Unanswered: can anyone help me with this...error

    The code below is for a check box that is in a form controlling if a volunteer in my volunteers database has a relationship with another and if so it keeps my reports from creating duplicates. (if this makes sense).

    What I really need is I'm getting an error.....

    Its giving me an error on:

    intShared = Dcount("[VolunteerID]","Relations", strCriteria)

    The error reads:

    "run-time error '3075'
    Syntax error (missing operator) in query expression '[VolunteerID]= & inVolunteerID'

    Code:
    Private Sub AddressShare_AfterUpdate()
    
    Dim intShared As Integer
    Dim intVolunteerID As Integer
    Dim strCriteria As String
    
    Forms!Volunteers!VolunteerID.SetFocus
    intVolunteerID = Forms!Volunteers!VolunteerID
    
    strCriteria = "[VolunteerID]= & intVolunteerID"
    
    intShared = DCount("[VolunteerID]", "Relations", strCriteria)
    
    If intShared > 1 Then
        MsgBox "This person already shares one address.  
        Volunteers cannot share two of the same addresses.  
        This will create duplicates!"
    ElseIf intShared = 1 Then
    
    End If
    
    End Sub
    Thanks in advanced.

  2. #2
    Join Date
    Jan 2004
    Posts
    75

    Re: can anyone help me with this...error

    should look like
    strcriteria = "'[volunteerID] = " & [intVolunteerID] & "'"

  3. #3
    Join Date
    Jan 2004
    Location
    OHIO
    Posts
    75

    thanks

    that does the trick!

    quick question...the prompt works however it only gives me a choice of "OK" and goes ahead and fills in the check box. i want the prompt to ask if they want to have duplicates and i need it to be two options:

    Yes or No.

    Not sure how to do that...

    Thanks!

  4. #4
    Join Date
    Jan 2004
    Posts
    75
    if MsgBox ("This person already shares one address.
    Volunteers cannot share two of the same addresses.
    This will create duplicates!", vbYesNo) = vbyes then

    followed by what you want to have happen if they say yes....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •