Scenario:
Work orders arrive and pertinent data is put into an Excel spreadsheet. Each time a work order is received and receiving individual must create a work order number in the format "YYMMDD-" number of work order for the day (e.g., 01, 02, etc.). The spreadsheet thing drives me crazy! There are about 20 fields so the sheet is spread to the right a long ways. i can adapt the data to a form to get reports, etc., but i'm having issues with the work order number. i can massage the date to what i want and i finally got DCOUNT() to stop throwing errors, but when i try to push a button to simulate adding a new record i get just the suffix that i want, not the complete serial number (i think) i design for.
Test database has 1 field, string [TestDate]. Form has 1 field [TestDate] and one button "Command5" with the code above attached to it. Pointers please?
Thanks,
Dave
Work orders arrive and pertinent data is put into an Excel spreadsheet. Each time a work order is received and receiving individual must create a work order number in the format "YYMMDD-" number of work order for the day (e.g., 01, 02, etc.). The spreadsheet thing drives me crazy! There are about 20 fields so the sheet is spread to the right a long ways. i can adapt the data to a form to get reports, etc., but i'm having issues with the work order number. i can massage the date to what i want and i finally got DCOUNT() to stop throwing errors, but when i try to push a button to simulate adding a new record i get just the suffix that i want, not the complete serial number (i think) i design for.
Code:
Private Sub Form_Load()
Dim mDate, mDateCount As String
mDate = Format(Date, "yymmdd")
MsgBox "mDate = " & mDate, vbOKOnly, "mDate Value"
mDateCount = DCount([TestDate], "table1", "[TestDate] = 'mDate'")
MsgBox "Dcount Date = " & mDateCount, vbOKOnly, "Dcount Dates"
End Sub
Private Sub Command5_Click()
If mDateCount = 0 Then
Me.TestDate = mDate & "-" & "01"
Else
Me.TestDate = mDate & "-" & mDateCount
End If
MsgBox "mDateCount = " & mDateCount, vbOKOnly, "mDateCount"
MsgBox "mDate = " & mDate, vbOKOnly, "mDate"
End Sub
Test database has 1 field, string [TestDate]. Form has 1 field [TestDate] and one button "Command5" with the code above attached to it. Pointers please?
Thanks,
Dave