Page 12 of 16 FirstFirst ... 2345678910111213141516 LastLast
Results 166 to 180 of 233
  1. #166
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    On error, the rest of the code is particular to that form/subform, so the action needs to happen there.

  2. #167
    Heathey94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2015
    Location
    United Kingdom
    Posts
    282
    Is the check not particular to that subform to? As it needs to look at the individual behaviour which has changed.

  3. #168
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    #165

    (needs 10 characters to post!)

  4. #169
    Heathey94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2015
    Location
    United Kingdom
    Posts
    282
    Yeah sorry - didn't notice it since it was the last one on the page. So how would I do it? Name them on the AfterUpdate then reference them on the module?

  5. #170
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Do you know what parameter means? (trying to write this as a question, nothing else?)

  6. #171
    Heathey94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2015
    Location
    United Kingdom
    Posts
    282
    In what context?

  7. #172
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Passing values to subroutines - those are called parameters.

  8. #173
    Heathey94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2015
    Location
    United Kingdom
    Posts
    282
    Oh, no. I'll give them a Google

  9. #174
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    In form: If SubroutineName(parameter,parameter,,,)=true/false then

    Public SubroutineName(parm1,parm2,,,,)

    ....code

    SubroutineName=True/False

  10. #175
    Heathey94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2015
    Location
    United Kingdom
    Posts
    282
    so something like...
    Public ChangeBehaviour(AssessmentID,BehaviourID,ResponseI D)
    Dim BehID As Long
    On Error Resume Next
    BehID = DLookup("BehaviourID", "TblAssessmentDetails", "BehaviourID=" & Me!BehaviourID & " AND AssessmentID=" & Me!AssessmentID & " AND ResponseID<>" & Me!ResponseID)
    If BehID > 0 Then
    MsgBox "This behaviour has already been selected."
    Cancel = True
    ChangeBehaviour=True
    End If

    on form:

    If ChangeBehaviour=True Then
    *undo insert of row/change of behaviour* <-I don't know where to start with that

  11. #176
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Cancel=true - wrong place
    Otherwise great!

    In the form you will have what you have now.

  12. #177
    Heathey94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2015
    Location
    United Kingdom
    Posts
    282
    Oh, so like this?
    Code:
    Public ChangeBehaviour(AssessmentID,BehaviourID,ResponseID)
    Dim BehID As Long
     On Error Resume Next
     BehID = DLookup("BehaviourID", "TblAssessmentDetails", "BehaviourID=" & Me!BehaviourID & " AND AssessmentID=" & Me!AssessmentID & " AND ResponseID<>" & Me!ResponseID)
     If BehID > 0 Then
     MsgBox "This behaviour has already been selected."
    ChangeBehaviour=True
     End If
    on form:

    Code:
    If ChangeBehaviour=True Then
    Cancel=true
    End if
    *undo insert of row/change of behaviour* <-I don't know where to start with that

  13. #178
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You're using "me" in a global sub?

  14. #179
    Heathey94 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2015
    Location
    United Kingdom
    Posts
    282
    Got halfway through a reply to this last night and forgot about it. That was a copy and paste error, but how do I reference it?

    Do I just dim BehaviourID on all 3 subforms or something?

  15. #180
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The value is in the parameter, so just remove the Me. BehaviourID is already defined on all three subforms, it is on the Record Source.

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

Similar Threads

  1. Replies: 13
    Last Post: 04-21-2016, 03:33 AM
  2. Macro to Open Form Triggers Exclusive Access Message
    By snakatsu in forum Database Design
    Replies: 5
    Last Post: 11-10-2015, 10:46 PM
  3. Replies: 6
    Last Post: 09-30-2015, 03:14 PM
  4. Multiple options based on a tree structure...
    By blue22 in forum Database Design
    Replies: 3
    Last Post: 01-09-2014, 05:58 AM
  5. Replies: 1
    Last Post: 08-01-2011, 04:17 PM

Tags for this Thread

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