Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    You're welcome!

    I recommend replacing the Macros of your project with VBA procedures.


    For example, for the btnContactEdit of the sfrm_contactlijst form, the code could be as follows:
    Code:
    Private Sub btnContactEdit_Click()
        If IsNull(Me.IDContact) Then
            Beep
        Else
            DoCmd.OpenForm "sfrm_contactedit", , , "IdContact=" & Me.IDContact, , acDialog
            Me.Requery
        End If
    End Sub

  2. #17
    chriscla is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2019
    Posts
    8
    Thanks for the advice. I was planning to do so, since I noticed that code gives more opportunities to customize things.

    I you allow we to take advantage of your expertise: I've been trying to translate what you've coded for the 'notities' form to the sfrm_contactnieuw form, but there is no combo box depending on the populated tekst box from the main form.
    What do I need to change to have the prospects name autofilled in on the sfmr_contactnieuw form?

    best regards
    Chris

  3. #18
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Hi Cris!

    Surely, your application has plenty of room for development and optimization, but, for this moment...
    add the proccedure below in the code module of the frm_fiche:
    Code:
    Public Sub AddSomething(ByVal strAddTo As String)
            With Me
            If IsNull(.Id) Then
                MsgBox "Please select a prospect.", vbInformation, Me.Caption
                .cboZoekProspect.SetFocus
            Else
                DoCmd.OpenForm strAddTo, acNormal, , , acFormAdd, acDialog, .Id
                Me.Requery
            End If
        End With
    End Sub
    For the Click event of the Nieuwe contactpersoon "button" give this code:
    Code:
    Me.Parent.AddSomething "sfrm_contactnieuw"
    of Nieuwe notitie give this:
    Code:
    Me.Parent.AddSomething "sfrm_notitieNieuw"
    and for Nieuwe offerte this:
    Code:
    Me.Parent.AddSomething "sfrm_offerteNieuw"
    As you can see, at the last three expressions, changing only the name of the form that you want to open.

    From the pop-up forms side, you can use the passed prospect ID as folows:

    For sfrm_contactnieuw:
    Code:
    Private Sub Form_Load()
        Me.c_rel_id = CLng(Me.OpenArgs)
    End Sub
    and for sfrm_offerteNieuw:
    Code:
    Private Sub Form_Load()
        Me.cmb_relatie = CLng(Me.OpenArgs)
    End Sub
    Cheers,
    John

  4. #19
    chriscla is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2019
    Posts
    8
    Hi John

    Thanks for your help again.
    I know there is a lot of room for improvement, but then I'll have to grow above my actual novice skills.

    Regarding your last solution, I noticed that after filling in a new prospect contact, when closing the popup form, the data are no longer those of the frm_fiche of the prospect that was selected, ie after adding a new contact to prospect 1 the frm_fiche is no longer that of prospect 1 after closing the sfrm_contactnieuw form.

    Any suggestions?

    Thanks
    Chris

  5. #20
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Quote Originally Posted by chriscla View Post
    Hi John

    Thanks for your help again.
    I know there is a lot of room for improvement, but then I'll have to grow above my actual novice skills.
    You're welcome!
    Self-improvement is a good reason to live.

    Quote Originally Posted by chriscla View Post
    Regarding your last solution, I noticed that after filling in a new prospect contact, when closing the popup form, the data are no longer those of the frm_fiche of the prospect that was selected, ie after adding a new contact to prospect 1 the frm_fiche is no longer that of prospect 1 after closing the sfrm_contactnieuw form.

    Any suggestions?

    Thanks
    Chris
    Remove the line Me.Requery from the Sub AddSomething() and add it afrer each Me.Parent.AddSomething "..."

    For example:
    Code:
    Private Sub Bijschrift22_Click()
        Me.Parent.AddSomething "sfrm_contactnieuw"
        Me.Requery
    End Sub
    Cheers,
    john

  6. #21
    chriscla is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2019
    Posts
    8
    Hi John

    Many thanks again. If everything were as simple as you make it look .

    Cheers
    Chris

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

Similar Threads

  1. Replies: 3
    Last Post: 06-23-2015, 02:40 PM
  2. Replies: 2
    Last Post: 10-21-2014, 07:57 AM
  3. Replies: 2
    Last Post: 04-27-2012, 06:28 PM
  4. combo box to Populate a form
    By rcappy in forum Forms
    Replies: 1
    Last Post: 01-30-2012, 03:07 AM
  5. populate boxes based on combo box choice
    By Mattm1958 in forum Forms
    Replies: 13
    Last Post: 08-30-2010, 02:09 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