I don't know if it would be appropriate for what you're trying to do, but would it make sense to move things like the command button (Command4) to the form header or form footer? Or am I misunderstanding the problem?
Rob
"KC" <kcjunk69[ at ]hotmail.com> wrote in message news:1159469629.011191.42620[ at ]b28g2000cwb.googlegroups.com...
[Quoted Text] >I have a form with two unbound combo boxes from which a user selects a > month and year of interest. The form also has textboxes whose control > sources are populated with the names of fields in my (as yet unrun) > stored procedure (actually it's a function). The form itself does not > have a recordsource defined. > > There is also a command button on the form: > > Private Sub Command4_Click() > Dim ldStrtDate As Date, ldEndDate As Date > > Me.RecordSource = "" > > Call GetDates(ldStrtDate, ldEndDate) > > Me.InputParameters = "[ at ]StrtDate = '" + Format(ldStrtDate) + > "',[ at ]EndDate = '" + Format(ldEndDate) + "'" > Me.RecordSource = "fn_GetSumbyDate" > > Me.Refresh > End Sub > > Now, everthing works absolutely perfectly as long as the dates selected > by the user are valid (ie there are records in the tables that fall > within the specified dates). However, if the dates specified result in > no records being returned from the function, ALL FIELDS DISAPPEAR FROM > THE FORM. > > Why? > How to fix? > > Thanks in advance, > KC >
|