If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
Funny Split Form Bug?
Hi all, I just found a funny thing in Ms Access 2007
I have a splitform, in the form Header I have a combobox to call a rowsource from a table(period),which have Period,Start date, End Date when I update/add the record at the form is OK! but when I update/add the record in datasheet problem will occurs for 2nd column and 3rd column, cboperiod.column(1)&(2)=null why ? is it a bug? or my code got problem? I tried this about few weeks only found different between form and datasheet key in. my code as per below; Private Sub Form_BeforeUpdate(Cancel As Integer) If IsNull(Me.YearMonth) Then Me.YearMonth = Me.CboPeriod Else End If Dim dCurrentDate As Date, dStart As Date, dEnd As Date, dtest As Date 'Set date as region date format or not ms access will treat as mm/dd/yyy dCurrentDate = Format(Me.TranDate, "dd/mm/yyyy") dStart = Format(Me.CboPeriod.Column(1), "dd/mm/yyyy") dEnd = Format(Me.CboPeriod.Column(2), "dd/mm/yyyy") If dCurrentDate dStart Or dCurrentDate dEnd Then MsgBox "Invalid Date, Date must within selected period" Cancel = True End If End Sub Private Sub cboPeriod_AfterUpdate() Dim dStart As Date, dEnd As Date, dtest As Date Me.Requery Me.Refresh Me.CboPeriod.DefaultValue = Me.CboPeriod End Sub Private Sub Form_Load() Me.Requery Me.Refresh End Sub |
Thread Tools | |
Display Modes | |
|
|