Daryl Sawyer wrote:

Sorry if this question is really basic. I'm creating a form to enter new data into my database, which includes a date field. For some reason I can't find, the form automatically inserts today's date. I have assigned the field no default value, neither in the table design nor in the form's column options. How do I stop it from doing this, or, at least, selecting all the text (so I can type over it) when I tab into it?

FYI, I'm running Ooo Base 2.0.2 on a machine running Windows XP Home Edition.
This is a known problem and the answer is in one of Andrew Pitonyak's OOo guides at:
http://www.pitonyak.org/database/

Basically, you need to set the field to an uninitialised (empty/null) date object using a macro. The macro would be called as one of the form reset event handlers. Here's the macro I use (modelled, somewhat on Andrew's examples), which will give you the idea:

Sub HandleSiteFormReset
 Dim oSiteInformationSheet As Object
 Dim oSiteInformationForm As Object
 Dim emptyDate  ' Uninitialised will clear the Date field
 Dim modified As Boolean

 Call InitSheetNames

oSiteInformationSheet = ThisComponent.Sheets.GetByName(vaSiteInformationSheetNames(0)) oSiteInformationForm = oSiteInformationSheet.Drawpage.Forms.GetByName(vaSiteInformationSheetNames(0))

 if oSiteInformationForm.IsNew then
   modified = oSiteInformationForm.IsModified
oSiteInformationForm.GetByName("Date_Site_Information_Entered").Date = emptyDate oSiteInformationForm.GetByName("Date_Site_Information_QAQC_Conducted").Date = emptyDate
   oSiteInformationForm.IsModified = modified
 endif

End Sub


Ross

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to