473,326 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

if the component value is blank then it shld show current date

syedshaffee
Hey People

please answer my question asked above...
Expand|Select|Wrap|Line Numbers
  1.  
  2. I am having a report in access where the field is date type so i require this field to show current date if value is blank otherwise record source value.
  3.  
  4.  
Aug 8 '12 #1

✓ answered by twinnyfo

If the report does not allow you to update the text box, add an unbound text box. Then, check the value of the underlying data and update the unbound text box to the date stored or the the current date, depending on what is in the table.

6 1658
twinnyfo
3,653 Expert Mod 2GB
syedshaffee,

I would add a small sub to the On Current event of the report that checks the value of the Date Value you are interested in. If it is null (no date) then update this control to the current date:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Current()
  2.     If IsNull(Me.txtDate) Then Me.txtDate = Date
  3. End Sub
  4.  
Hope this helps!
Aug 8 '12 #2
twinnyfo,
The Component has a control source buddy 'll it allow me to do the same
Aug 8 '12 #3
twinnyfo
3,653 Expert Mod 2GB
If the report does not allow you to update the text box, add an unbound text box. Then, check the value of the underlying data and update the unbound text box to the date stored or the the current date, depending on what is in the table.
Aug 8 '12 #4
twinnyfo,
Thanx, man you are a life saver thanx a million
Aug 8 '12 #5
twinnyfo
3,653 Expert Mod 2GB
Glad I could help. If you would be so pleasant as to select my response as the best answer....
Aug 8 '12 #6
zmbd
5,501 Expert Mod 4TB
You can do this in your underlying query by using a calculated field. Use the IIF to determine if the data is there or not and either return the field value or the formatted date. Use this calculated field as the record source for your your control.

Here's a simple example...
Table3 has two numeric fields [F1] and [F2].
[F1] is required and primary key
[F2] is allowed to be null.
You could make them date fields.
A simple select query that returns all of the records for [F1][F2] and calculated field [z_return0]; however, if [F2] is null then it returns a numeric zero in the field [z_return0]

Expand|Select|Wrap|Line Numbers
  1. SELECT  Table3.f1, 
  2.     Table3.f2, 
  3.     IIf(IsNull([f2]),0,[f2]) AS z_return0
  4. FROM Table3;
You can return a formatted date or what ever...

No VBA code to write and will work if the code is disabled.

-z


-z
Aug 8 '12 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John Norvell | last post by:
I just noticed that recently the javascript I was using to format and display the last modified date of my web page is always reporting the current date instead. It used to work fine. This is true...
5
by: Larry R Harrison Jr | last post by:
I use the Lebans calendar control and love it; the only thing is that it commonly starts out at the year 1899 rather than the current year. Is there a way to specifically tell it to start at the...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
1
by: Jamie87 | last post by:
I need to know how to display the current day,date,time,month and year on a form. I can only get it to say 'Monday' for the day and 'January' for the month etc. I cant get it to say the current...
2
by: Jamie87 | last post by:
I need to know how to display the current day,date,time,month and year on a form. I can only get it to say 'Monday' for the day and 'January' for the month etc. I cant get it to say the current...
2
by: Claes Wedin | last post by:
My customer needs a DateTimePicker in VS2005 C# that can show emty date values (blank/space/null). I need a control that: 1. Can show a blank value 2. Detete a date when hitting the delete...
1
by: thokala | last post by:
Hi Everyone, I have XML file. It have some date to display the Graph. In that file i need to provide the date value. I would like to give the current date instead of hard coded date. I tried...
7
by: sharmilah | last post by:
Hi all It's me again. I now want to specify the current date in the format '26/06/2007' ie date/month/year as the default value in my mysql database. Which implies that by default the value of my...
2
by: Neil99 | last post by:
I'm using a macro to transfer a table to txt file, which is fine but I want to run it each day (as the table contents change) and include the date in the filename without having to manually rename...
12
by: AccessBeetle | last post by:
I have a qry bound form showing the search results based on the user entered criteria. There is a button called Edit on that form. The form is locked initally to stop user to edit any record...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.