ShowDataForm Date format wrong

  • Thread starter Thread starter RichardS
  • Start date Start date
R

RichardS

I have an Excel database with dates in the format
dd/mm/yyyy. If I select the Data | Form option from the
standard menu bar, the dates look fine. If I activate the
DataForm through VBA with the above command, the dates
display as mm/dd/yyyy. I can overwrite the date using the
Data Form in the correct format, then scroll back to that
record and it still displays as mm/dd/yyyy. Underlying
data is fine, just the display on the Data Form when
called using VBA is incorrect.
 
Yes Indeed interesting :(....

Will try to dig out a bit... but looks like some setup issue
 
Grüezi Richard

RichardS schrieb am 19.05.2004
I have an Excel database with dates in the format
dd/mm/yyyy. If I select the Data | Form option from the
standard menu bar, the dates look fine. If I activate the
DataForm through VBA with the above command, the dates
display as mm/dd/yyyy. I can overwrite the date using the
Data Form in the correct format, then scroll back to that
record and it still displays as mm/dd/yyyy. Underlying
data is fine, just the display on the Data Form when
called using VBA is incorrect.

When you activate the DataForm by VBA Excel will use the US-Format to
display dates - aour issue is a typical regional-settings problem. I think
you don't have US-regional-settings?

Instead of something like this

ActiveSheet.ShowDataForm

try the following:

ActiveSheet.UsedRange.Cells(1, 1).Activate
Application.CommandBars.FindControl(ID:=860).Execute

You have to select first *1* cell within the datarange of your worksheet.
Thats what the first line is for. If you already know cour range you can
activate a cell directly by its address.

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
 
-----Original Message-----
Grüezi Richard

RichardS schrieb am 19.05.2004
I have an Excel database with dates in the format
dd/mm/yyyy. If I select the Data | Form option from the
standard menu bar, the dates look fine. If I activate the
DataForm through VBA with the above command, the dates
display as mm/dd/yyyy. I can overwrite the date using the
Data Form in the correct format, then scroll back to that
record and it still displays as mm/dd/yyyy. Underlying
data is fine, just the display on the Data Form when
called using VBA is incorrect.

When you activate the DataForm by VBA Excel will use the US-Format to
display dates - aour issue is a typical regional-settings problem. I think
you don't have US-regional-settings?

Instead of something like this

ActiveSheet.ShowDataForm

try the following:

ActiveSheet.UsedRange.Cells(1, 1).Activate
Application.CommandBars.FindControl(ID:=860).Execute

You have to select first *1* cell within the datarange of your worksheet.
Thats what the first line is for. If you already know cour range you can
activate a cell directly by its address.

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
.
Thomas,

Thank-you very much. Works like a charm

Regards

Richard
 
Grüezi Richard

RichardS schrieb am 20.05.2004
Thank-you very much. Works like a charm

I'm glad aou like it :-)

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top