Ask Your Question
0

Access form date field data from base macro

asked 2019-02-07 18:49:10 +0100

dougcb68 gravatar image

I am designing a form in which the user will enter beginning and ending dates. I will use these dates in a macro to create an sql SELECT string. Unfortunately, I have been unable to determine how to access the data entered in the date field from my macro. My best guess at the code is:

Sub DateTest DIM oForm as OBJECT DIM oStartBox as OBJECT 'This is a date field on oForm DIM dDate as DATE

oForm = ThisComponent.Drawpage.Forms.getByName("sqlForm")
oStartBox= oForm.getByName("StartBox") 

dDate = oStartBox.getCurrentValue()     
msgbox dDate

end sub

"StartBox" is a date field located on the "sqlForm". I execute the macro using a push button on the form after entering a date in the date field.

I get the error message: BASIC runtime error. Incorrect property value.

This seems like it should be a very simple operation, and it probably is, but I am missing something.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-02-07 19:27:29 +0100

Ratslinger gravatar image

Hello,

You can find the answer in the LO documentation - LibreOffice Base Handbook in Chapter - 9 - Macros. Look in section - Converting dates from a form into a date variable (Page 37).

This post is about the same -> Time&Datefield in Dialogue saving text instead of time&date.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-02-07 18:49:10 +0100

Seen: 25 times

Last updated: Feb 07