Results 1 to 3 of 3
  1. #1
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57

    Dlookup when yes/no box clicked

    I have a table (Current Meds) nested on my form that has a yes/no box (discontinue) clicked in every data entry. When i click on the yes/no box (discontinue) I want to copy all the data in that row and add it to a different nested table (tblNotesCurrentMeds) on that same form. I cant get it to work can anybody help my code so far.


    Code:
    Private Sub Discontinue_AfterUpdate()
    If Discontinue = -1 Then
    Initial = DLookup("Initial", "Current Meds", "IDCurrentMeds = '" & [IDCurrentMeds] & "'")
    Else
    End If
    End Sub

  2. #2
    uncletreetrunk is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2012
    Posts
    72
    DLookup will return what set it out to look for not the entire row. You may want to change the name of the variable you set DLookup so it doesn't match the field name.

    As for being able to "copy" and "paste" rows with VBA you'll have to wait for someone who is more skilled with access to help you.

    Short read on DLookup: http://www.techonthenet.com/access/f...in/dlookup.php

  3. #3
    whojstall11 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    57
    yea i know it not going to return the entire row if i get the first one working it is the same for the rest of them so it should look something like
    Code:
    Initial = DLookup("Initial", "Current Meds", "IDCurrentMeds = '" & [IDCurrentMeds] & "'")
    date = DLookup("date", "Current Meds", "IDCurrentMeds = '" & [IDCurrentMeds] & "'")
    nest = DLookup("nest", "Current Meds", "IDCurrentMeds = '" & [IDCurrentMeds] & "'")
    but ill try changing up the fields.

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

Similar Threads

  1. Replies: 13
    Last Post: 11-08-2011, 11:57 AM
  2. disabling an enabled button that has been clicked.
    By aaron47 in forum Programming
    Replies: 3
    Last Post: 08-26-2011, 09:49 AM
  3. Replies: 1
    Last Post: 02-17-2011, 06:23 AM
  4. Autonumbering when a checkbox is clicked?
    By kutehart in forum Forms
    Replies: 1
    Last Post: 08-02-2010, 09:03 AM
  5. How to pass what was clicked to module?
    By nichojo in forum Modules
    Replies: 11
    Last Post: 07-22-2010, 08:27 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