Date from form into Append

  • Thread starter Thread starter CJ
  • Start date Start date
C

CJ

Hi Groupies:

This question is actually a follow up to the post: Daily Transaction Input -
March 31

So, I have an unbound main form with a combo and an unbound text box. The
text box is used for date input.
The user enters the date then pushes a button to make an append query run. A
subform then returns all of the transactions that the append query created.

My Problem, is that the date on the transactions the append query creates is
not the same as the date in my text box on the main form. If I add criteria
to the subform to only show transactions for the input date, I receive no
records becuase the date is not getting into the transactions. My logic
tells the query to run, then the form to load on the subform.

I have played with this and can not get the dates into the transactions when
the append runs.

Any suggestions?

Thanks
 
Have the Append query read the date directly from the form. If you are just
opening the Append query to make it run, set the column to the form's value.
It should look something like:

INSERT INTO NewTable( ID, DateField )
SELECT ID, [Forms]![frmSample]![DateField] AS DateField
FROM tblOtherData;
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Hi Arvin:

Absolutely excellent! Works great!!

FYI groupies, this is my code for the query:

INSERT INTO tblDaily ( strJobNumber, lngItemIndex, dtmDayUsed )
SELECT tblProjectItems.strJobNumber, tblProjectItems.lngIndex,
[Forms]![frmDailyList]![txtInputDate] AS dtmDayUsed
FROM tblProjectMaster INNER JOIN tblProjectItems ON
tblProjectMaster.strJobNumber = tblProjectItems.strJobNumber
WHERE
(((tblProjectItems.strJobNumber)=[Forms]![frmDailyList]![cmbJobNumber]));

and this is my code for the button on the form:

Private Sub cmdShowDaily_Click()

DoCmd.SetWarnings False

DoCmd.OpenQuery "qappDailyList"
Me.fsubDailyList.Visible = True
DoCmd.Requery "fsubDailyList"

DoCmd.SetWarnings True

End Sub

Thanks very much!!


Arvin Meyer said:
Have the Append query read the date directly from the form. If you are
just
opening the Append query to make it run, set the column to the form's
value.
It should look something like:

INSERT INTO NewTable( ID, DateField )
SELECT ID, [Forms]![frmSample]![DateField] AS DateField
FROM tblOtherData;
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

CJ said:
Hi Groupies:

This question is actually a follow up to the post: Daily Transaction Input -
March 31

So, I have an unbound main form with a combo and an unbound text box. The
text box is used for date input.
The user enters the date then pushes a button to make an append query
run. A
subform then returns all of the transactions that the append query created.

My Problem, is that the date on the transactions the append query creates is
not the same as the date in my text box on the main form. If I add criteria
to the subform to only show transactions for the input date, I receive no
records becuase the date is not getting into the transactions. My logic
tells the query to run, then the form to load on the subform.

I have played with this and can not get the dates into the transactions when
the append runs.

Any suggestions?

Thanks
 
Back
Top