Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 6th, 2005, 03:00 PM
Tish Tish is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 15 Tish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 38 sec
Reputation Power: 0
Date problems with insert into statement

I have and insert into statement which includes a date in short date format. This is the statement to add new records into the table:

ElseIf (ModMode = "Add") Then 'Adding a new record
strSQL = "INSERT INTO tblPWO (FY, CATEGORY, RCN, PWO, PWOTITLE, PLANNED, INTCOMMIT, COMMITTED, OBLIGATED, OBLIGATEDDATE, EXPENDED, PONUMBER, LOG, SCHEDULE, QUALITY, RISK)"
strSQL = strSQL & " VALUES ('" & Me!FYComboBox.Value & "','" & Me!CATComboBox.Value & "',"
strSQL = strSQL & "'" & Me!RCNComboBox.Value & "','" & Me!PWO.Value & "','" & Me!PWOTITLE.Value & "',"
strSQL = strSQL & Me!PLANNED.Value & "," & Me!INTCOMMIT.Value & "," & Me!COMMITTED.Value & ","
strSQL = strSQL & Me!OBLIGATED.Value & "," & Me!EXPENDED.Value & ",'" & Me.POCombo.Value & "',"
strSQL = strSQL & Me!OBLIGATEDDATE.Value & ","
strSQL = strSQL & "'" & Me!ScheduleCombo.Value & "','" & Me!QualityCombo.Value & "','" & Me.RiskCombo.Value & "',"
strSQL = strSQL & "'" & Me!LOG.Value & "')"

The obligated date (highlighted in bold) will not update properly. What do I need to do to allow the date to be inserted properly in the "Add" mode? When in edit mode on the form, I can execute an Edit docs query which runs properly.

Thanks,

Tish

Reply With Quote
  #2  
Old January 6th, 2005, 03:37 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 4
Tish,

Does the order in your sql have any bearing on your insert statement? The Me!Obligateddate is not in the same order as shown by the Insert Into statement. Don't know if that would make any difference or not. But was curious.

lwells

Reply With Quote
  #3  
Old January 7th, 2005, 09:24 AM
Tish Tish is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 15 Tish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by lwells
Tish,

Does the order in your sql have any bearing on your insert statement? The Me!Obligateddate is not in the same order as shown by the Insert Into statement. Don't know if that would make any difference or not. But was curious.

lwells

Although I put the date in the correct place as the insert into statement, the system automatically entered "12/30/1899 12:00:03 AM." Any other suggestions?

Thanks

Tish

Reply With Quote
  #4  
Old January 7th, 2005, 10:34 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 4
Tish,

Try this and see if this helps

strSQL = strSQL & "#" & Me!OBLIGATEDATE & "#" & ","

Sometimes you have to tell access that you are working with date formats and the # on either end is necessary. Not sure in this case but see if it works.

lwells

Reply With Quote
  #5  
Old January 7th, 2005, 01:24 PM
Tish Tish is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 15 Tish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by lwells
Tish,

Try this and see if this helps

strSQL = strSQL & "#" & Me!OBLIGATEDATE & "#" & ","

Sometimes you have to tell access that you are working with date formats and the # on either end is necessary. Not sure in this case but see if it works.

lwells

I tried this, but I receive the error "can't find the field OBLIGATEDDATE referred to in your expression.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Date problems with insert into statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway