Datevalue( ' Thedate') When 'thedate' Is Empty

Feb 2, 2007

Hi guys , i've got a webpage where i'm essentially joining five tables with different data fields in.

I've done this by creating a tempary table putting all the information in fields that are like and then displaying it.

Thing is to insert the dates of various things i've used the datevalue('thedate') in my insert statement , however if the field 'thedate' has nothing in it I get an error message data type missmatch.

I'm pretty sure this is because the datevalue function it trying to do datevalue('') .

Is there anyway I could do a IfIsnull("", Datevalue('thedate'))

within the SQL statement of an ASP page

i'm not too sure of the syntax but basically i want to be able to do datevalue('thedate') if there is a value for 'thedate' but if there isn't do nothing....

hope that makes sense ...

View Replies


ADVERTISEMENT

Datevalue

Jul 24, 2007

In Excel there is a function called Datevalue() that will return the dates computer serial number. See below example:
Formula Description (Result)
=DATEVALUE("8/22/2008") Serial number of the text date, using the 1900 date system (39682)
=DATEVALUE("22-AUG-2008") Serial number of the text date, using the 1900 date system (39682)
=DATEVALUE("2008/02/23") Serial number of the text date, using the 1900 date system (39501)
=DATEVALUE("5-JUL") Serial number of the text date, using the 1900 date system, and assuming the computer's built-in clock is set to 2008 (39634)

Is there a function in Access that will do the same thing?

View 11 Replies View Related

Syntax Problem With DateValue() In Query

Apr 24, 2008

I have a select query with a number of expressions and I cannot seem to get the expressions to work. Access keeps giving me syntax error on the following code:


SELECT Run.Test_Case,

Sum(IIf(DateValue([Attempted_Actual]) < DateValue([Attempted_Actual]),[Points],0))/Sum(IIf(Not IsNull([Attempted_Actual]),[Points],0))*100 AS ActualAttempted,
Sum(IIf(DateValue([Completed_Actual]) < DateValue([Completed_Actual]),[Points],0))/Sum(IIf(Not IsNull([Completed_Actual]),[Points],0))*100 AS ActualCompleted,
Sum(IIf(DateValue([Verified_Actual]) < DateValue([Verified_Actual]),[Points],0))/Sum(IIf(Not IsNull([Verified_Actual]),[Points],0))*100 AS ActualClosed,


Sum(IIf(DateValue([Attempted_Planned]) < DateValue(Date()),[Points],0))/Sum(IIf(Not IsNull([Attempted_Planned]),[Points],0))*100 AS PlannedAttempted,
Sum(IIf(DateValue([Completed_Planned]) < DateValue(Date()]),[Points],0))/Sum(IIf(Not IsNull([Completed_Planned]),[Points],0))*100 AS PlannedCompleted,
Sum(IIf(DateValue([Verified_Planned]) < DateValue(Date()),[Points],0))/Sum(IIf(Not IsNull([Verified_Planned]),[Points],0))*100 AS PlannedClosed


FROM Run INNER JOIN Task ON Run.Run=Task.Group
GROUP BY Run.Test_Case;
HAVING (((Run.Test_Case)=IIf(IsNull([Forms]![Status]![ComboStatusTestCase]),[Test_Case],[Forms]![Status]![ComboStatusTestCase])));



I am sort of confused on where the error could because it just says there is a syntax error. My assumption is that I am using DateValue() in the wrong context. If anyone has any pointers or sees my error please let me know.

Thanks,

View 3 Replies View Related

Queries :: Using DateValue Function With Query

Aug 1, 2014

How do I use the DateValue function with a query that pulls data between dates? Here is my code below. I'm getting an error that my expression is too complex or incorrect.

Code:
SELECT IIf([tblAUCodes].[BusinessLine] Like '*CMES*',"CMES",IIf([tblAUCodes].[BusinessLine] Like '*HOUS*',"CMES",IIf([tblAUCodes].[BusinessLine] Like 'CTO',"CTO",IIf([tblAUCodes].[BusinessLine] Like 'Shareowner*',"WFSS","SPS")))) AS LOB, Count(tblPACSTemplate.temID) AS CountOftemID, tblPACSTemplate.Type, DateValue([ApprovedDate]) AS ApproveDate

[Code] ....

View 8 Replies View Related

Queries :: Using Datevalue As Parameter From A Form

Apr 23, 2013

In my QBE, I have a field call [startDate]

In my criteria, I am passing a parameter from a form.

Currently, I am using: DateValue([forms]![myForm]![txtStartDate])

From myFORM, the value of the text box is 3/1/2013

When I run the query, it runs as expected and returns all records with the 3/1/2013 dates.

But now I want to make it where if the parameter is null.

How do I change that criteria if that parameter I am passing is null from my form's textbox? I want it to return all records that have a null entry in the [startDate].

View 5 Replies View Related

Empty Field - But NOT Really

Oct 18, 2007

Hello World:I have two tables, one called Assets and the other table called Job Sites. the Assets table has several fieldsAssetID - autonumberplus othersthe Job Sites table has two fieldsJobSiteID - autonumberJobSite - text (with about 22 names in it)the I add the JobSite to the Assets table (hiding the JobSiteID) it shows me the expected drop down box but it is BLANK. If I click on any of the BLANK spaces in the drop down, it populates the field. It is behaving as if the font color was white.Any ideas??? I am baffled. :confused: :confused:

View 8 Replies View Related

My Query Is Empty :/

Jul 12, 2005

Hello,

I have just created a query so that I may base my report on it. The query ties together 4 tables. I only included the fields that will be in my report. I created the report using the wizard and used my new query as the source but it does not want to work. I tried opening the query and it was empty even though I have entries in the database.

ANY IDEAS :confused:

View 2 Replies View Related

Empty Dates.. Why 12:00:00 AM???

Jul 15, 2005

Dear All,

I'm trying something quite simple, adding dates into a table with the aid of an action SQL statement (INsert Into) in VBA.

However, if a date is empty, the value 12:00:00 AM is filled in! I really want that if it a date is set to empty, that noting is added to the table... I can use an if statement though, to fix it, but why does it fill in 12:00:00 AM if a date is empty?? Can you fix it? Or is there no other way?

I use Access 2003.

tnx,
Zurvy :eek:

View 11 Replies View Related

Get Rid Of Empty Fields

Jul 27, 2005

I have a query that appends records to a table with a constant numer of fields. so sometimes I have fields with no data. is there any way to create query which selects only fields with data.

thanks in advance

View 1 Replies View Related

Empty Field

Jul 7, 2006

I am trying to make a query with two tables. Each row consist of a student ID, their name and all their personal information. Both tables are exactly the same. But one table is a link table. That link table gets update every so often from an outside program and the other table is not linked. I want to be able to run a query that updates certain fields called "address changes". I have figured out how to find the updates, but I am having a problem with a field that is blank. If I have a field in the non-linked table that is empty but there is information in the linked table, it does not see it. Is there a way to get around this empty field problem?

View 3 Replies View Related

Empty Records

Apr 24, 2008

I have been going back in a db to the beginning of time and restructuring...I have a field sales person if its null I need to assign a value of 100 to another field representativeid, I have been using the update query to accomplish the update until now. I've tried is null and "" to get this query to update, any idea?

View 4 Replies View Related

Fields Do Not Empty

Mar 14, 2006

I have an Input form that does not clear the fields after I hit the Save button. Data Entry is set to YES. If I use the navigation bar, there is no problem, but I would like to have the fields empty after hitting the Save Button, so that the navigation bar can be removed. What is wrong?

View 4 Replies View Related

Empty Subform

May 30, 2006

Hi guys, here is my new problem.I have a form which conatins a subform that shows info from a query.I created a query which shows records from table history when the field comment is like *code 1.the criteria in the query, in the comment field is: [forms]![edititem]![vconcate]In the edititem form i have a hidden field called vconcate which receives the value as follows:me.vconcate= "*code " & me.winecode (me.winecode is integer)after assigning the value to vconcate i display the vconcate value and shows*code 1, as it should be. However, the subform doesnt displays any record.I also tryed to insert the query in the editform, but nothing.if i run the query from the query window, and fill the value as *code 1, it works.here is more info:when the edititem is open, the user has to select a wine code from a combo box. After this selection the values are assigned to me.winecode and the me.vconcate. Because when i open the form edititem these codes are null or empty the subform is empty. Is there any way to refresh the subform via code?any suggestion?

View 1 Replies View Related

Empty Combo Box

Jun 6, 2006

Hey guys......simple problem
I have a form with 3 combo boxes.

The 1st combo, called winecode, gets the values from the following sql:
SELECT [winecode] FROM wine WHERE winedesable=0;
it works.....

The second combo box, called suppname, gets the values from another select, but depending on the previous combo:
SELECT DISTINCT [supplier].[suppname] FROM supplier, suppwine WHERE [supplier].[suppnumber]=[suppwine].[suppnumber] And [suppwine].[winecode]=[Forms]![addpop]![winecode];
it works......

The 3 rd combo, called winesubcat, gets the values from a query which takes the selected value from the previous 2 combos. The query works by it self . However, i added the query in the data tab and open the form. then i selected values from the first 2 combos and there is no value in the 3rd combo...... any idea??

thx max.

View 1 Replies View Related

Empty Combo Box Help

Oct 24, 2006

When I click a button I have code (below) that checks to see if my Combo boxes are NULL (empty), and if they are it’ll prompt the user to “fill in all fields”. Right now it includes all of the combo boxes on my form. Although, I want it to only include 3 combo boxes (I have 5 on my form). How could I do this, lets say if my combo box names are cbo1, cbo2, cbo3 ?


For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acComboBox
If ctl.Value & "" = "" Then
MsgBox "You must fill in all data fields."
Exit Sub
End If
End Select
Next

View 3 Replies View Related

Null And Empty

Apr 15, 2005

In a previous post someone mentioned a difference between Null and Empty. Is Null is not pulling the nulls but I know those fields are empty. Can someone tell me how to pull in these empty fields. for my calculation I need to get Companies that showed revenue after and didn't show revenue once their contract started.

Thank you

View 2 Replies View Related

If Query Is Empty?

Jul 13, 2005

Hello, I have writen a piece of code:

Code:DoCmd.RunSQL "SELECT tblTrades.tradeID, tblTrades.TradeConfirm, tblTrades.Laurent FROM tblTrades WHERE (((tblTrades.TradeConfirm)=No) AND ((tblTrades.Laurent)=Yes));"

How do I check to see if it returns any results?

View 2 Replies View Related

Empty Recordset Help

Oct 3, 2005

Help.

I can seem to find a way to test if the SQL for my record set returns value. I've tried using the if statement with .BOF and .EOF. When there are no records returned for the criteria, there should be a way to test it with IF. I can't seem to figure it out. Using the record count does not work because it also returns at least one record. Help.

Here is the code

Dim rsContacts As ADODB.Recordset

Set rsContacts = New ADODB.Recordset

SQLStr = "SELECT FormatPercent(((43200-Sum(DateDiff('n',[tblOutageDetail.StartTime],[tblOutageDetail.endtime])))/43200),2) AS ElapsedTime FROM (qryOutageTotalMin INNER JOIN tblOutageData ON qryOutageTotalMin.Outage = tblOutageData.Outage) INNER JOIN tblOutageDetail ON tblOutageData.Outage = tblOutageDetail.Outage WHERE (((tblOutageData.System)='PARK PRIMARY') AND ((tblOutageDetail.StartTime)>=Date()-30) AND ((tblOutageDetail.OtgCat)=1))"

With rsContacts

.Open SQLStr, CurrentProject.Connection, adOpenStatic, adLockReadOnly

End With

'Me!btnparkpri.Caption = CStr(rsContacts!ElapsedTime)

'Set rsContacts = Nothing

If rsContacts.RecordCount = 1 Then

Me!btnparkpri.Caption = CStr(rsContacts!ElapsedTime)

End If

If Me!btnparkpri.BackColor = 255 Or Me!btnparkpri.BackColor = 32768 Then

Me!btnparkpri.ForeColor = 16777215

End If

Set rsContacts = Nothing

View 2 Replies View Related

Empty Fields

Jul 7, 2006

I am trying to make a query with two tables. Each row consist of a student ID, their name and all their personal information. Both tables are exactly the same. But one table is a link table. That link table gets update every so often from an outside program and the other table is not linked. I want to be able to run a query that updates certain fields called "address changes". I have figured out how to find the updates, but I am having a problem with a field that is blank. If I have a field in the non-linked table that is empty but there is information in the linked table, it does not see it. Is there a way to get around this empty field problem?

Thanks

View 2 Replies View Related

Empty Pages On Report

May 9, 2005

Hello visitors,

I have a report base on a select query but in the report i get the following:

page 1 = record 1
page 2, page 3, page 4 = are empty (nothing to see on the pages)
page 5 = record 2
page 6, page 7, page 8 = are empty (nothing to see on the pages)
page 9 = record 3
...........etc...
So there are three empty pages between every two pages(records).

I have checked in the settings of the report and all properties but cannot find the solution.

Can any one help me to solve this ?
Thanks in advance

View 3 Replies View Related

Problem With Empty Fields

Dec 21, 2005

i wonder if anybody can give me a hand here...

i have an SQL insert query as follows:

DoCmd.RunSQL "INSERT INTO Despatches (" & _
"[SupplierRef], " & _
"[DespDate], " & _
"[TimeIn], " & _
"[TimeOut], " & _
"[QtyLoaded], " & _
"[Shift], " & _
"[DocRef], " & _
"[TrailerRef], " & _
"[SealRef], " & _
"[Comments], " & _
"[TeamLeader]) " & _
"VALUES ('" & Supplier & "'," & _
date1 & "," & _
time1 & "," & _
time2 & "," & _
DespQty_1 & ",'" & _
shift1 & "','" & _
docref_1 & "','" & _
trailer_1 & "','" & _
seal_1 & "','" & _
comments_1 & "','" & _
TeamLeader.Value & "');"

This is working fine as long as I input the values for all the fields...when some values are missing, I get the error that Access can't append the query due to validation rule violations...got no clue what to do !

plss help!:o

View 4 Replies View Related

I Don’t Won’t To Show A Field When It Is Empty.

Jan 27, 2007

Can anyone help me with this small problem?

Using expression builder what expression do I use to not display the filed in my query if the field is formatted as currency and is blank (showing £00.00)

View 6 Replies View Related

Form Open Up Empty

May 31, 2007

I have a form with a subform on it. My subform gets populated by a lookup. On my main form I have an unbound (cboLotIDLU) lookup field and also a text box (LotID) that shows the chosen record. When I open the form my cboLotIDLU is blank but my LotID has an ID in it so the info for that ID is displayed on my subform. I would like everything to open up blank. I've looked around and I can't see where that first record is coming from. How do I get it so everything comes up empty?

View 14 Replies View Related

Empty Spaces Issue

Aug 6, 2007

Hi,
I imported an Excel spreadsheet into Access. As you know, Access will automatically create 255 characters size for each 'text' datatype.

Now the issue is, when I create a query and I specify
Right([Field Name],3) I get no/empty results. I know my query syntax is correct, but the issue is, Access is picking up the right 3 character of the 255 field size. But in reality, my field's data are not 255 characters long; the max is probably 30 characters.

So, the question is, how do I go about picking up the 'actual' right 3 characters?

Please advise. Thanks!

Leon

View 4 Replies View Related

Updating EMPTY Cells

Sep 2, 2007

I need to update column 'customer' in table 'db' with a name of a customer.
Currently this column is empty from data.

I do following , but it doesn't work.

UPDATE db SET Customer = 'Microsoft'
WHERE Customer='';

Where is the problem.

View 2 Replies View Related

Possible To Remove The First Record Or Last Empty

Jan 29, 2007

When i create a table from scratch there is always a record and also when i run a query on the table there is always an empty record at the last line. Is there anyway to i cant get rid of it or hide it. it can be confusing and the user might add line that not suppose to be there.

thanks in advance

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved