How do I make just one entry?

T

Tcs

I have an update query that I run interactively. I want it to append just one (1) record to my
'RunHistory' table. ( A table of when I ran this series of queries, who the user was, how many
records read, etc. ) When I've used VB in a module, I've never had any problem. But this one,
which I run interactively, keeps wanting to make multiple entries. Ever increasing multiple
entries, it seems.

---

INSERT INTO
tblMEAGReview_RunHistory
( [TimeStamp],
DayOfWeek,
[User],
PeriodYear,
PeriodMonth,
StartDate,
StartTime )

SELECT
Now() AS Expr1,
Format(Now(),"dddd") AS Expr4,
CurrentUser() AS Expr2,
tblMEAGReview_Period.PeriodYear,
tblMEAGReview_Period.PeriodMonth,
Format(Now(),"mm/dd/yy") AS Expr5,
Format(Now(),"Short Time") AS Expr3

FROM
tblMEAGReview_RunHistory, tblMEAGReview_Period;

---

I can't see it. I'm hoping someone else can. Any ideas as to what I need to do, or not do, to get
just one entry?

Thanks in advance,

Tom
 
G

George Nicholson

FROM
tblMEAGReview_RunHistory, tblMEAGReview_Period;

With no join, I would think this would "Select" RunHistory.RecordCount x
Period.RecordCount records.

Since RunHistory isn't in the SELECT clause, remove it from the FROM clause.
Then, assuming Period contains a single record, you should only have a
single record appended to RunHistory.

HTH,

Tcs said:
I have an update query that I run interactively. I want it to append just
one (1) record to my
'RunHistory' table. ( A table of when I ran this series of queries, who
the user was, how many
records read, etc. ) When I've used VB in a module, I've never had any
problem. But this one,
which I run interactively, keeps wanting to make multiple entries. Ever
increasing multiple
entries, it seems.

---

INSERT INTO
tblMEAGReview_RunHistory
( [TimeStamp],
DayOfWeek,
[User],
PeriodYear,
PeriodMonth,
StartDate,
StartTime )

SELECT
Now() AS Expr1,
Format(Now(),"dddd") AS Expr4,
CurrentUser() AS Expr2,
tblMEAGReview_Period.PeriodYear,
tblMEAGReview_Period.PeriodMonth,
Format(Now(),"mm/dd/yy") AS Expr5,
Format(Now(),"Short Time") AS Expr3

FROM
tblMEAGReview_RunHistory, tblMEAGReview_Period;

---

I can't see it. I'm hoping someone else can. Any ideas as to what I need
to do, or not do, to get
just one entry?

Thanks in advance,

Tom
 
T

Tcs

Outstanding! That did it!

Thanks so much.

FROM
tblMEAGReview_RunHistory, tblMEAGReview_Period;

With no join, I would think this would "Select" RunHistory.RecordCount x
Period.RecordCount records.

Since RunHistory isn't in the SELECT clause, remove it from the FROM clause.
Then, assuming Period contains a single record, you should only have a
single record appended to RunHistory.

HTH,

Tcs said:
I have an update query that I run interactively. I want it to append just
one (1) record to my
'RunHistory' table. ( A table of when I ran this series of queries, who
the user was, how many
records read, etc. ) When I've used VB in a module, I've never had any
problem. But this one,
which I run interactively, keeps wanting to make multiple entries. Ever
increasing multiple
entries, it seems.

---

INSERT INTO
tblMEAGReview_RunHistory
( [TimeStamp],
DayOfWeek,
[User],
PeriodYear,
PeriodMonth,
StartDate,
StartTime )

SELECT
Now() AS Expr1,
Format(Now(),"dddd") AS Expr4,
CurrentUser() AS Expr2,
tblMEAGReview_Period.PeriodYear,
tblMEAGReview_Period.PeriodMonth,
Format(Now(),"mm/dd/yy") AS Expr5,
Format(Now(),"Short Time") AS Expr3

FROM
tblMEAGReview_RunHistory, tblMEAGReview_Period;

---

I can't see it. I'm hoping someone else can. Any ideas as to what I need
to do, or not do, to get
just one entry?

Thanks in advance,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top