Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Hi Ant,

    An interrim post.

    It would help both of us if you set one VBA option. While in the VBA window click on 'Tools' in the menu bar and then select 'Options.' Make sure the 'Require Variable Declaration' is checked (second in the list).

    Click image for larger version. 

Name:	options.jpg 
Views:	8 
Size:	24.2 KB 
ID:	8296

    What this does is put 'Option Explicit' at the head of each new module - existing modules need to be updated manually. What this means is that VBA will detect typos immediately. Without this option VBA will assume any typo is a new variable!



    Also become familiar with Intellisense. As you type each statement, VBA does a pretty good job of determining what you're doing and provides a list of possibilities or an aide memoire of the syntax. If you are given a list then you can scroll up and down, [Tab] selects the highlighted entry. If you are not given a list, try [Ctrl]+[Spacebar]. This last works for variables that you have defined, VBA will extend your variable name or give you a list to choose from. For example, if I have declared a variable called 'MfrmPickList' then simply typing 'mfrmp[Ctrl]+[Spacebar]' will probably type the whole name for me, at the very least it will give me a list from which I can select the name I want. (If it's not there then something is wrong. Stop and sort it out.) In this particular example MfrmPickList is an object. If I type a full stop (period) after the name, Intellisense immediately lists all the public properties and methods available in that object. As you get used to Intellisense you will begin to wonder how you ever got on without it.

  2. #17
    Antinomy is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    8
    Rod,

    No problem! I think I got everything where it needs to be.

    Last things first - the form name is correct for my DB (I typed "form" instead of "frm" when I was creating it).

    I fixed the declarations section to appear as above.

    Finally, I dropped in the addparticipants code from your 8:06 PM post (I saved the original in case I shouldn't have used it). When I debugged it threw an error:

    Compile error: Method or data member not found

    The highlighted text is ".ID" in the "Me.ID" in the second line.

    Ready to move forward when you are - thanks again, Rod.

    Ant.

  3. #18
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    I can immediately think of three things that could cause the error:

    1. The attribute in the conversations table is named something other than ID;
    2. The field on the form is called something other than ID;
    3. The variable lngConversationID has not been declared as public in frmPickList


    Anyway I'm sending you a complete working prototype db plus some commentary. See how you get on.

    Ant01.pdf

    MSAFAnt.accdb

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

Similar Threads

  1. Replies: 4
    Last Post: 06-18-2012, 07:01 AM
  2. Adding new partial records to a subform
    By DarkWolff in forum Forms
    Replies: 7
    Last Post: 03-06-2012, 04:05 PM
  3. Editing in a subform within a report
    By Malachi Constant in forum Programming
    Replies: 9
    Last Post: 10-28-2011, 06:50 AM
  4. Adding Records in a Subform
    By chris.williams in forum Forms
    Replies: 3
    Last Post: 10-14-2011, 01:21 PM
  5. Adding multiple records in subform
    By randolphoralph in forum Programming
    Replies: 1
    Last Post: 05-12-2010, 09:42 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