Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742

    Yes that is incorrect.

    Create a new Module ( I have acc2003 so I can't tell you how it is in 2007 or 2010), but go to the screen with the Tables, Queries, Forms etc.
    What you need to do is
    - in a new standard module
    - copy and paste the procedure SplitAdviceGiven
    - save the module with a name of your choice.

    Then we'll deal with the form and button.

  2. #17
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68
    ok, have created module and saved as AdviceGiven

    Thanks for your patience with this

    Marc

  3. #18
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    Ok,
    now for your form

    Here is the code I have for my button which I called btnRunSplit

    Your code should have similar format/syntax.
    Code:
    Private Sub btnRunSplit_Click()
    'This is the code behind the button
    'It is private to this Form
    On Error GoTo Err_btnRunSplit_Click
    
    SplitAdviceGiven 'This is the call to the procedure
                     'The procedure runs to completion (or error)
                     'And returns here to finish this Click event code
        
    
    Exit_btnRunSplit_Click:
        Exit Sub
    
    Err_btnRunSplit_Click:
        MsgBox Err.Description
        Resume Exit_btnRunSplit_Click
        
    End Sub

    Note:

    You could put a msgbox "SplitAdvice has completed",vbOkOnly at the end of either the standard module procedure, or the Click event code.

  4. #19
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68
    Hi

    Did everything like that, decided to make button name same as yours. But when ran got error 3265 (see below). I checked all the fields names, they all match

    Click image for larger version. 

Name:	untitled2.JPG 
Views:	4 
Size:	116.9 KB 
ID:	7614

  5. #20
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    You could have another button to run the query to get your counts. Or you could just have a query that you run from the List of Queries.

    I am going out for a few hours but will check back later.

    Good luck with your project.

    If you are testing your set up and have to run the procedure a few times you may want to add the following line, to keep your output data "clean" (not duplicates from multiple runs).


    ...Set db = CurrentDb
    Set rs = db.OpenRecordset("MarcAdviceGiven")
    Set rsTemp = db.OpenRecordset("TempTableForQuery")

    'Delete existing records from theTempTable
    db.Execute "Delete * from TempTableForQuery", dbFailOnError

    Do While Not rs.EOF
    arrHold() = Split(rs!adviceGiven, ",")....

  6. #21
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    I was sending my last message when yours arrived.

    Did the code run?
    You don't have a module called "AWF_Related" but I don't think the error is there.

  7. #22
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    If you do a Ctrl-G (cntrl key and G together), you will open the immediate window.
    What info is there?
    The debug.print statements in the procedure will write info to the immediate window for debugging purposes.

    Using debug.print statements is a good debugging technique

  8. #23
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68
    When did Ctrl-G this is my screen, any help? with the 3265 error?

    Click image for larger version. 

Name:	untitled3.JPG 
Views:	4 
Size:	154.2 KB 
ID:	7615

  9. #24
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    You're still using the MarcAdviceGiven table in this one???

    The data in the immediate window shows the code has executed

    Open your temp table and you'll see the records.

    Am heading out, but will check in.

  10. #25
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68
    I changed it back to original table, still the same. The data in the immediate window only has records ofr the same URN and the same advice given (see below)

    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application
    MLF000128 - Developing your application

    Thats all that was executed I am afraid. I have checked all the fields and they are all spelt the same etc...

    Marc

  11. #26
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    The only thing I can think of that we didn't discuss was the temp table.

    You will have to manually create a table that has the layout shown in the attached jpg.
    And you'll have to name it the same as in the procedure "TempTableForQuery".

    (I thought I sent this info, but can not find it in the thread --maybe I sent it somewhere else.
    Anyway, try this. If it doesn't resolve the issue, we'll get at it tomorrow.
    Attached Thumbnails Attached Thumbnails TempTable.jpg  

  12. #27
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68
    hi

    Sorted..It was the field name in the TempTable. I have created a TempTable, but I had called the field AdviceGiven, not AdviceString. I had a bit work tidying up the data as some of the strings were very long. But I got there in the end.

    many thanks for your patience in this. I have learned some more access through this.

    thanks

    Marc

  13. #28
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742
    In all procedures it is advisable to use error handling. Check things for a value, file exists etc.
    Glad you got it sorted out.
    Make use of the forum; we are all here to help. And we all learn.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Separating VALUES in FIELDS/COLUMNS
    By taimysho0 in forum Queries
    Replies: 11
    Last Post: 11-30-2011, 05:32 PM
  2. Separating a date into day, month and year
    By teirrah1995 in forum Reports
    Replies: 3
    Last Post: 07-17-2011, 02:17 PM
  3. Replies: 5
    Last Post: 02-26-2011, 07:12 AM
  4. Separating Tables from Forms, etc
    By rtcary in forum Access
    Replies: 6
    Last Post: 07-16-2010, 01:39 PM
  5. Replies: 4
    Last Post: 09-03-2009, 02:01 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