Results 1 to 4 of 4
  1. #1
    mishraye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    2

    Newbie questions - combo box criteria, etc.

    I am relatively new to Access and I'm not a programmer. I'm typically good at teaching myself by Googling problems and trial-and-error. However in this case I'm spending a lot of time and think I need a little guidance :-)



    Project overview:
    I'm making a project management database. I'll have forms for job info, companies, contacts, products, purchase orders, warranties, etc. I have a bunch of tables including queries, lookup tables, etc.

    Where I'm getting stuck:
    1. When I'm entering info in the Job Info form, there is a combo box for "company". The user can select the company, and I want them to be able to add a new company if the company doesn't exist yet. But not just type in the name, actually open up the company form and enter all the company info properly. I created a button next to the company combo box that will do this, but I was wondering if there is a way to do this within the combo box so I don't have to have a separate button? Eg they can click on "not found" and that will automatically open the company form.
    2. Beneath where they have just entered the company name, there is a combo box for "contact". I want this to display only contacts for that company.

    Thanks in advance!

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    Use the "Not In List" of the combo box to trigger the opening of the "Company Detail" form.
    For the "contacts" combo form: Read up on Cascading Combo boxes.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    mishraye is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    2
    Quote Originally Posted by Bob Fitz View Post
    Use the "Not In List" of the combo box to trigger the opening of the "Company Detail" form.
    This is what I came up with:
    Code:
    Private Sub Owner_Company_NotInList(NewData As String, Response As Integer)
    If MsgBox("This company is not in the list." & vbNewLine _
    & "Would you like to add this company to the list?", _
    vbInformation + vbYesNo, "Not included in the list.") _
    = vbYes Then
    DoCmd.OpenForm "frmCompanies", , , , acFormAdd
    End If
    Response = acDataErrContinue
    End Sub

    It opens the Companies form as intended, and when the user fills out the company info, they click a button to save and close the window. So then when they're back on the job info page, the company has not automatically appeared in the list and the prompt comes up again. I feel like I'm barking up the wrong tree here...

    Thanks!

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    Try
    Code:
    Private Sub Owner_Company_NotInList(NewData As String, Response As Integer)
     If MsgBox("This company is not in the list." & vbNewLine _
       & "Would you like to add this company to the list?", _
       vbInformation + vbYesNo, "Not included in the list.") _
       = vbYes Then
         DoCmd.OpenForm "frmCompanies", , , , acFormAdd
         Response = acDataErrAdded
     Else
         Response = acDataErrContinue
     End If
    End Sub
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Newbie w/a few questions
    By Davo in forum Access
    Replies: 3
    Last Post: 11-14-2011, 01:13 PM
  2. Couple of newbie questions
    By Awowk in forum Access
    Replies: 12
    Last Post: 08-06-2010, 01:16 PM
  3. Basic questions from a newbie! :(
    By Michael_ in forum Access
    Replies: 6
    Last Post: 05-07-2010, 02:41 PM
  4. Replies: 11
    Last Post: 01-21-2010, 11:01 AM
  5. newbie questions
    By bigmac in forum Access
    Replies: 0
    Last Post: 10-07-2008, 12:53 AM

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