Results 1 to 12 of 12
  1. #1
    RobFII is offline Novice
    Windows 11 Access 2019
    Join Date
    Mar 2024
    Posts
    6

    Data from ComboBox not populating Date field

    Hello all. I have a quick question. I'm sure it's an easy answer and I am just missing something with this. I have a legacy 2008 MDB database that was converted over to a SQL server. Conversion went as planned and made the old Database a SQL front end. Linked the tables to the new SQL tables, all is working as intended.



    The database is a very simple Cert of Calibration database. There are only three tables, Data, Equip and CofC Data. The Equip table holds the Equipment that is used for Calibration, the asset number and the Calibration Due Date. The Form used to enter the Cal data for our products has a ComboBox drop down and the user would select a piece of Equip and it would populate the fields in the form with the ID, Description, Asses and Cal Due Date. Whomever originally created the DB NEVER used the Equip table. Rather they coded the different pieces of Eq for the COmboBox as a Value List. This would have been fine but with 10 ComboxBox fileds, anytime the Cal date needed to be updated was a PITA. THus my idea to utilize the Equip table instead.

    With the new Query, the data is getting pulled from the Equip table and populating all the fields on the Form EXCEPT the Cal Date field (CD10).
    Here is the Code I am using for the On Change Event for Field ID10

    Private Sub ID10_Change()
    Me.Equip10.Value = Me.ID10.Column(1)
    Me.Tag10.Value = Me.ID10.Column(2)
    Me.CD10.Value = Me.ID10.Column(3)

    The CD field is the only field not populating the data from the Equip table and not sure what I am missing.

    Any suggestions would be grateful!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Combos start at index 0?

    Have you got the correct number of columns in it's property.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    RobFII is offline Novice
    Windows 11 Access 2019
    Join Date
    Mar 2024
    Posts
    6
    Hello. I had to double check lol. Yes, starts at 0 and there are four columns with the Date column being the fourth or (3) in the code. The Equip10 and Tag10 fields populate just fine.

  4. #4
    RobFII is offline Novice
    Windows 11 Access 2019
    Join Date
    Mar 2024
    Posts
    6
    I think I need to clarify what I am asking for. SO the ComboVox dropdown shows all the correct information. When I select an Item, not all of the data is getting populated in the form.The CD10 (Date) field does not populate. All the others do.


  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Show us the results of the combobox source. I can only assume there is something wrong with the date structure.
    Are you using standard date in SQL or some fancy DateTime2 format?

    You need to attach pics here, you cannot just copy and paste, though it looks like you can.

    What version of Access are you using now?

    https://www.google.com/search?q=sql+...hrome&ie=UTF-8
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I presume you have set the combo columncount property to 4?

  7. #7
    RobFII is offline Novice
    Windows 11 Access 2019
    Join Date
    Mar 2024
    Posts
    6
    Here is the rub of all this. I didn't perform the conversion to SQL, we have a third party company take care of this. I think you are correct in assuming there is something strange with the SQL date field type. Originally when the conversion was done, they had the all the date fields set to Date with time. I reached out to the company that did the conversion and they modified the field to just be date with yyyy-mm-dd format. Now the dates display correctly on the form for the existing data.

    We use Office 365 Apps for Enterprise.

    Thanks for the heads up on pics, yeah I was wondering why the Post never got...posted.

    First is the Combox and second is the Linked SQL Table it's pulling from.

    Click image for larger version. 

Name:	Access issue 01.png 
Views:	11 
Size:	1.8 KB 
ID:	51643Click image for larger version. 

Name:	Access issue 02.png 
Views:	11 
Size:	5.4 KB 
ID:	51644

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Post 4 was moderated, I'm posting to trigger email notifications.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Perhaps they set the date type to datetime2, when just datetime would be enough?
    What happens when you do need to store the time?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    RobFII is offline Novice
    Windows 11 Access 2019
    Join Date
    Mar 2024
    Posts
    6
    Quote Originally Posted by CJ_London View Post
    I presume you have set the combo columncount property to 4?
    Ok it's official, I am a dumbass! I knew it was something simple I was over looking!!!! The column count was set to 2!!!! The date column is 3!!!! Sometimes an extra set of eyes is all it takes.

    Thank you SO MUCH! I can move forward with getting this deployed now.

    Thank you again!

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    I asked that in post #2
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    RobFII is offline Novice
    Windows 11 Access 2019
    Join Date
    Mar 2024
    Posts
    6
    Quote Originally Posted by Welshgasman View Post
    I asked that in post #2
    You did indeed. I was bouncing back and forth with a few tasks and just missed it. My apologies.

    I very much appreciate the assistance.

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

Similar Threads

  1. Replies: 39
    Last Post: 09-04-2023, 05:52 AM
  2. Replies: 4
    Last Post: 02-24-2020, 05:53 PM
  3. Replies: 7
    Last Post: 05-12-2014, 06:05 AM
  4. Replies: 13
    Last Post: 08-08-2013, 12:22 PM
  5. Replies: 4
    Last Post: 04-26-2012, 11:04 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