|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
Quote:
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 |
|
#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 |
|
#5
|
|||
|
|||
|
Quote:
I tried this, but I receive the error "can't find the field OBLIGATEDDATE referred to in your expression. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Date problems with insert into statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|