Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 34
  1. #16
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664

    Is "AssessionNumber" a number or text as defined in the table?

  2. #17
    KerryAustin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    27
    Thank you for the example. I set up a new combobox to look up the Assession number in the list. That appears to work fine. I don't understand the Me.Filter. How do I get the record to populate back to the form for editing. For example my table tblDelay has the following fields (dept, Rm_Num, MRN, AssessionNumber) associated form textboxs (cboDept, cboRmNum, txtMRN, txtAssessionNumber). I I can get a few to post back to the form I can probable work on getting all of them If I can get an example.

    Thank you for your help.
    Kerry

  3. #18
    KerryAustin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    27
    AssessionNumber is a number field Long Integer General Number

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    The Me.Filter filters the form recordset to display the record that has the assession number.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #20
    KerryAustin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    27
    So was this to populate the form with the recordset. If so, It did not populate.

  6. #21
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If the form is bound to the table with AssessionNumber field, the filter should work.

    Post code or provide db for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #22
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I don't think anyone has asked this question, as yet: Is [AssessionNumber] actually defined as a Number Datatype Field in the underlying Table? Or could it be, as is often the case with 'numbers' that consist of digits but are not used in math, actually defined as a Text Datatype?

    Linq ;0)>

  8. #23
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Asked in 16 and answered in 18.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #24
    KerryAustin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    27
    My database has some private information so I can't send. Here is the code:

    Private Sub cboAssessionSearch_AfterUpdate()
    If Not IsNull(DLookup("AssessionNumber", "tblDelay", "AssessionNumber=" & Me.AssessionNumber)) Then
    'code to filter form for the existing record
    Me.Filter = "AssessionNumber=" & Me.AssessionNumber
    Me.FilterOn = True
    Else
    'code to move to new record row
    DoCmd.GoToRecord , , acNewRec
    End If
    End Sub

  10. #25
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I don't see anything wrong with code - it's exactly what I suggested.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #26
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by June7 View Post
    Asked in 16 and answered in 18.
    I need to back off of my medication or maybe increase it!

  12. #27
    KerryAustin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    27
    June7, so this works partially. When I select a Assession Number for the combobox I get a Run-time error '3022'. It stats in part ...will create duplicate values in the index. I also have cboDept as a required field. It sends Run-time error '3314' Must enter a value in the tblDelay.Dept field. Can I add a error handle for Dept?

    Thanks,
    Kerry

  13. #28
    KerryAustin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    27
    I forgot to mention that once I end the debug, the Assession number is populated in txtAssessionNumber field on the form.

    KA

  14. #29
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Not sure why that duplication error happens. If you want to provide latest version, will review.

    If field in table is defined as required, then data must be entered. I don't know if that message can be captured by error handler because it really isn't a run-time error - it's not triggered by bad code. I don't often set a field as required. I deal with data validation programmatically.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #30
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by KerryAustin View Post

    ...When I select a Assession Number for the combobox I get a Run-time error '3022'. It stats in part ...will create duplicate values in the index....
    It sounds as if the Assession Number Combobox is Bound to the Field in the underlying Table; for doing this kind of thing (if I'm understanding what you're trying to do) the Combobox has to be Unbound.

    Quote Originally Posted by June7 View Post

    ... I don't often set a field as required. I deal with data validation programmatically...

    ...I don't know if that message can be captured by error handler because it really isn't a run-time error - it's not triggered by bad code...
    I never set a Field as Required, either, but it can be trapped. If Dept is the only Required Field this will do it:
    Code:
    Private Sub Form_Error(DataErr As Integer, Response As Integer)
    
    If DataErr = 3314 Then 'Required Field has been omitted
      
     Response = MsgBox("Department is a Required Field!", vbExclamation, "Please Select Data For This Field")
     Response = acDataErrContinue
     cboDept.SetFocus
    
    End If
    
    End Sub

    Linq ;0)>

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

Similar Threads

  1. Check to see if record already exists
    By zipaway in forum Programming
    Replies: 4
    Last Post: 06-05-2014, 09:16 AM
  2. Check if record exists, Check Number
    By burrina in forum Forms
    Replies: 9
    Last Post: 01-06-2013, 03:49 PM
  3. Replies: 3
    Last Post: 10-19-2012, 04:30 PM
  4. Replies: 1
    Last Post: 03-06-2012, 06:45 PM
  5. Check to see if record id exists in joined table
    By csoseman in forum Programming
    Replies: 1
    Last Post: 08-18-2011, 01:06 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