Date Format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In all my fields which store date, I display them in Medium Date Format. The
problem is that when I display them in an unbound text and in a listbox, it
doesn't display the Medium Date Format. How do I get them to do so? Thanks.

ck
 
In all my fields which store date, I display them in Medium Date Format. The
problem is that when I display them in an unbound text and in a listbox, it
doesn't display the Medium Date Format. How do I get them to do so? Thanks.

ck

In the unbound text control, set the Format property to Medium date.

In the List box, use a query SQL to format the date field:

Select TableName.Field1, TableName.Field2, Format([DateField],"Medium
Date") as ADate From Table Name;
 
Thanks fredg for the quick help. The unbound text box is actually pointing to
another listbox column no 3. I have the Format to display Medium Date format
but it doesn't work. Is it because it is pointing to a column no? Thanks.
ck

fredg said:
In all my fields which store date, I display them in Medium Date Format. The
problem is that when I display them in an unbound text and in a listbox, it
doesn't display the Medium Date Format. How do I get them to do so? Thanks.

ck

In the unbound text control, set the Format property to Medium date.

In the List box, use a query SQL to format the date field:

Select TableName.Field1, TableName.Field2, Format([DateField],"Medium
Date") as ADate From Table Name;
 
You can do that by putting in ControlSource property of selected unbound
control next statement:
 
Hi fredg,
Having problem with what you have suggested. Basically my code looks like
this:

Private Sub lisbox1_Click()
Me.listbox2.RowSource = "SELECT lngSWPurchaseNo, Format
_([dteSWDatePur],"Medium Date"), txtCompanyName, curPrice, lngSWPurInfoNo _
FROM qrySWPurchase WHERE lngSoftwareNo = " & Me.lstSWPurchase & ""
End Sub

It doesn't seem to like the extra double-quotes around the Medium Date.
ck

fredg said:
In all my fields which store date, I display them in Medium Date Format. The
problem is that when I display them in an unbound text and in a listbox, it
doesn't display the Medium Date Format. How do I get them to do so? Thanks.

ck

In the unbound text control, set the Format property to Medium date.

In the List box, use a query SQL to format the date field:

Select TableName.Field1, TableName.Field2, Format([DateField],"Medium
Date") as ADate From Table Name;
 
Hi fredg,
Having problem with what you have suggested. Basically my code looks like
this:

Private Sub lisbox1_Click()
Me.listbox2.RowSource = "SELECT lngSWPurchaseNo, Format
_([dteSWDatePur],"Medium Date"), txtCompanyName, curPrice, lngSWPurInfoNo _
FROM qrySWPurchase WHERE lngSoftwareNo = " & Me.lstSWPurchase & ""
End Sub

It doesn't seem to like the extra double-quotes around the Medium Date.
ck

fredg said:
In all my fields which store date, I display them in Medium Date Format. The
problem is that when I display them in an unbound text and in a listbox, it
doesn't display the Medium Date Format. How do I get them to do so? Thanks.

ck

In the unbound text control, set the Format property to Medium date.

In the List box, use a query SQL to format the date field:

Select TableName.Field1, TableName.Field2, Format([DateField],"Medium
Date") as ADate From Table Name;

That's because you are setting the rowsource using VBA code and it's
already within quotes, i.e. Rowsource = "Select .. etc."
In this case use the single quote in the format expression:
Format([DateField],'Medium Date')
 
Hi fredg,
Having problem with what you have suggested. Basically my code looks like
this:

Private Sub lisbox1_Click()
Me.listbox2.RowSource = "SELECT lngSWPurchaseNo, Format
_([dteSWDatePur],"Medium Date"), txtCompanyName, curPrice, lngSWPurInfoNo _
FROM qrySWPurchase WHERE lngSoftwareNo = " & Me.lstSWPurchase & ""
End Sub

It doesn't seem to like the extra double-quotes around the Medium Date.
ck

Use double doublequotes: if you want to include " inside a string
delimited by ", you need to use two in a row.

Me.listbox2.RowSource = "SELECT lngSWPurchaseNo, _
Format([dteSWDatePur],""Medium Date""), txtCompanyName, curPrice, _
lngSWPurInfoNo FROM qrySWPurchase WHERE lngSoftwareNo = " _
& Me.lstSWPurchase & ";"


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Thanks, John.
ck

John Vinson said:
Hi fredg,
Having problem with what you have suggested. Basically my code looks like
this:

Private Sub lisbox1_Click()
Me.listbox2.RowSource = "SELECT lngSWPurchaseNo, Format
_([dteSWDatePur],"Medium Date"), txtCompanyName, curPrice, lngSWPurInfoNo _
FROM qrySWPurchase WHERE lngSoftwareNo = " & Me.lstSWPurchase & ""
End Sub

It doesn't seem to like the extra double-quotes around the Medium Date.
ck

Use double doublequotes: if you want to include " inside a string
delimited by ", you need to use two in a row.

Me.listbox2.RowSource = "SELECT lngSWPurchaseNo, _
Format([dteSWDatePur],""Medium Date""), txtCompanyName, curPrice, _
lngSWPurInfoNo FROM qrySWPurchase WHERE lngSoftwareNo = " _
& Me.lstSWPurchase & ";"


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top