Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 35
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972

    Navigating object properties is very basic Access functionality. Get familiar with the organization of the Properties sheet.
    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.

  2. #17
    Join Date
    Jan 2014
    Posts
    28
    Yes finally
    Thank You Guys so much
    I have been struggling with this for a long time and you guys helped me solve it instantly
    Thank You So Much

  3. #18
    Join Date
    Jan 2014
    Posts
    28
    Owe You Guys Big Time!!!!!

  4. #19
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I suggest you study the code and also the various results it may produce. There are a lot of If then Else statements that when certain criteria is met, different results happen. I would do extensive testing by trying to create different scenarios where each If Then statement’s results are tested.

  5. #20
    Join Date
    Jan 2014
    Posts
    28
    Hey Guys
    I finally solved it thanks to your help
    I really owe it you guys thanks for all the help
    I had been struggling with this for weeks

  6. #21
    Join Date
    Jan 2014
    Posts
    28
    Actually hold on guys
    How comes the option is till there once it is selected
    how do i enter code so that when the option is selected it is no longer shown in the combo box

  7. #22
    Join Date
    Jan 2014
    Posts
    28
    Hey Guys i just realised that there is something wrong
    the option is still available once it is selected.
    what code do i need to enter to ensure that the option is not shown in the list once it has been selected by the user for that certain day
    eg:-
    someone is booked at 12:00 Pm
    how do I remove the 12:00 Pm Slot from the combo box so that it can not accidentally be selected again by the user

  8. #23
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Selecting an item from combobox list does not naturally remove the item. That requires some more complex code (or complicated query if the RowSource is based on a query - yours is not).
    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
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I took a look at the video and you need the second loop.

    Code:
    Dim i As Date, n As Integer, oRS As DAO.Recordset
    Dim sSQL As String, dDuration As Date
    Dim dLowerbreak As Date, dUpperBreak As Date
    cboTime.RowSourceType = "Value List"
    cboTime.RowSource = ""
    'If IsNull(Start) Then Exit Sub Else i = Start
    If IsNull(Me.Start) Then Exit Sub Else i = Me.Start
    
            If Me.NewRecord = True Then
               DoCmd.RunCommand acCmdSaveRecord
            End If
        
        sSQL = "SELECT DoctorsID,AppointDate,AppointTime"
        sSQL = sSQL & " FROM qrySubformAppoints"
        sSQL = sSQL & " WHERE DoctorsID=" & Me.id & _
        " AND AppointDate=#" & Me.txtAppointDate & "#"
        Set oRS = CurrentDb.OpenRecordset(sSQL)
        dDuration = TimeValue("00:30")
        dLowerbreak = Break - TimeValue("00:25") 'Break is a field
        dUpperBreak = Break + TimeValue("00:25")
        
        If oRS.RecordCount = 0 Then
           Do
              If i <= dLowerbreak Or i >= dUpperBreak Then
                 cboTime.AddItem i
              End If
              i = i + dDuration
           Loop Until i >= txtEnd
        Else
           Do
              If i <= dLowerbreak Or i >= dUpperBreak Then
                 oRS.FindFirst "[AppointTime] Between #" & i - TimeValue("00:00:05") & _
                 "# And #" & i + TimeValue("00:00:05") & "#"
                 If oRS.NoMatch Then cboTime.AddItem i
              End If
            Loop Until i >= txtEnd
    
        End If
        oRS.Close
        Set oRS = Nothing
    Also, there are before update and after update events for the combos tht you will need. Didn't study that code. The video is just painfully slow for me to watch.

  10. #25
    Join Date
    Jan 2014
    Posts
    28
    so does that above code mean that the option ill be gone once it has been selected

    what code is required to make the combo box work in a way that the option is removed from the list once it is selected by the user so that it can not be accidentaly entered again by the user

  11. #26
    Join Date
    Jan 2014
    Posts
    28
    hey guys can any of you help me out create the code so that it does what i said in previous posts

  12. #27
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Might be the BeforeUpdate and AfterUpdate code that ItsMe indicated is in the video. I won't be able to watch it to find out.
    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.

  13. #28
    Join Date
    Jan 2014
    Posts
    28
    sorry what do you mean

  14. #29
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    ItsMe said (see post 24) there was more code in that YouTube video that was placed into the BeforeUpdate and AfterUpdate events of the combobox and indicated you would need that code also.
    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
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    I see you started another thread on this topic https://www.accessforums.net/access/...elp-40469.html

    If your original question is resolved, then I consider this thread closed.
    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.

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

Similar Threads

  1. Replies: 7
    Last Post: 07-24-2013, 02:01 PM
  2. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  3. Replies: 2
    Last Post: 06-23-2012, 11:59 PM
  4. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  5. Replies: 6
    Last Post: 09-28-2011, 09:20 PM

Tags for this Thread

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