gilly01625
New Member
- Joined
- Nov 8, 2024
- Messages
- 36
- Office Version
- Prefer Not To Say
- Platform
- Windows
Hi,
I have a userform which allows the user to fill a range of text boxes and combo boxes with information, and once an 'Add' button is pressed, the information is stored into a table on a worksheet. The user can then 'retrieve' the same information back into the userform by double clicking on a row within a List Box which is displaying the table information.
I have x2 text boxes which require the user to input a start time, and an end time in the format of HH:MM. This format is stored in the table, however when the data is 'retrieved', it is converted into a number with many decimal places. For example, user inputs '10:00', but when 'retrieved', the text boxes displays '0.416666666666667'.
Any idea why and how I go about fixing this?
Below is the code from the 'retrieval' of information.
I have a userform which allows the user to fill a range of text boxes and combo boxes with information, and once an 'Add' button is pressed, the information is stored into a table on a worksheet. The user can then 'retrieve' the same information back into the userform by double clicking on a row within a List Box which is displaying the table information.
I have x2 text boxes which require the user to input a start time, and an end time in the format of HH:MM. This format is stored in the table, however when the data is 'retrieved', it is converted into a number with many decimal places. For example, user inputs '10:00', but when 'retrieved', the text boxes displays '0.416666666666667'.
Any idea why and how I go about fixing this?
Below is the code from the 'retrieval' of information.
VBA Code:
'===================================================================================================
'Pull Table Contents to Userform Input Options
'===================================================================================================
Private Sub lstWorkDatabase_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Me.txtDateStart = Format("DD/MM/YYYY")
Me.txtDateEnd = Format("DD/MM/YYYY")
Me.txtWID.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 0)
Me.txtWREF.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 1)
Me.cmbClient.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 2)
Me.txtSubClient.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 3)
Me.cmbType.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 4)
Me.txtLocation.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 5)
Me.txtDateStart = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 6)
Me.txtDateEnd.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 7)
Me.txtS1Start.Text = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 8)
Me.txtS1End.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 9)
Me.txtS2Start.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 10)
Me.txtS2End.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 11)
Me.txtS3Start.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 12)
Me.txtS3End.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 13)
Me.txtQuotedHours.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 14)
Me.txtActualHours.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 15)
Me.cmbTransportType.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 16)
Me.txtTransportTotal.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 17)
Me.txtMileage.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 18)
Me.txtPetrol.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 19)
Me.txtParking.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 20)
Me.txtHourly.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 21)
Me.txtDay.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 22)
Me.txtSalary.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 23)
Me.txtTotal.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 24)
Me.cmbIID.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 25)
Me.cmbPSID.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 26)
Me.txtNotes.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 27)
Me.cmbCountry.value = Me.lstWorkDatabase.List(Me.lstWorkDatabase.ListIndex, 29)
End Sub