Proper Query Type

G

Guest

I posted yesterday about trying to use a MakeTable query to auto assign
College Weekenders to Students. You can get all the info from the post "How
do I use a record only once when making a table from a query?" posted on
3/6/05. I want to make sure that I am using the right query type. Also I
have not had much sucess with the code provided in the post.
 
G

Guest

Hi.
I posted yesterday about trying to use a MakeTable query to auto assign
College Weekenders to Students. You can get all the info from the post "How
do I use a record only once when making a table from a query?" posted on
3/6/05.

Don't be surprised if folks don't jump at the chance to help you on this
thread after you started, then quickly abandoned, the last one. It's
considered discourteous to abandon a thread that several people have taken
the time to offer help with until all avenues have been addressed on the
original thread, or one of the participants suggests that a new thread be
started, or several days have passed and no new information is being
discussed.

If you have time constraints restricting the amount of time that you can
spend on this problem, then I would suggest calling Microsoft tech support
(free for first incident, but $245 per incident thereafter for phone support)
or hiring a consultant (often with more reasonable prices), who can help you
overcome each hurdle, often within minutes.
I want to make sure that I am using the right query type.

Perhaps. It depends upon the situation. Remember that a properly
normalized database stores data in one place, so creating a make table query
to produce a new table from data already stored in the database can make
sense if a large data set is used and speed is needed -- and none of the data
in this new table will be updated (updates, adds and deletes should occur on
the source tables only, with the new table created from the Make Table query
to get the latest data as needed). Otherwise, the data set can come from a
SELECT query, which is likely to be less work to maintain data integrity and
will use less disk space.
Also I
have not had much sucess with the code provided in the post.

Please tell the respondents in the original thread exactly what is not
working and give them a chance to help.

A quick glance at some of the code that you may be having problems with
reveals SQL statements that assume your Majors field is a numeric field.
(You didn't say otherwise.) If this field holds a string data type (Text or
Memo), not numerical (Number, AutoNumber, Currency), then the string must be
enclosed by either single quotes or a pair of double quotes to delineate the
beginning and end of the string. It's often easiest to use single quotes,
such as the following:

SQL_Students = "SELECT * " & _
" FROM Students AS S1 "
"WHERE S1.Majors = '" & CurrentMajor & "';"

SQL_CWtable = "SELECT * " & _
" FROM CWtable AS C1 "
"WHERE C1.Majors = '" & CurrentMajor & "';"

I suggest asking Duane and Chris for help on any of the rest you may be
having problems with.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts, so that all
may benefit by filtering on "Answered questions" and quickly finding the
right answers to similar questions. Remember that the best answers are often
given to those who have a history of rewarding the contributors who have
taken the time to answer questions correctly.
 
G

Guest

Oops. I forgot to fix some of the syntax besides the single quotes in my
earlier post. It should read:

SQL_Students = "SELECT * " & _
"FROM Students AS S1 " & _
"WHERE S1.Majors = '" & CurrentMajor & "';"

SQL_CWtable = "SELECT * " & _
"FROM CWtable AS C1 " & _
"WHERE C1.Majors = '" & CurrentMajor & "';"

Sorry for any confusion.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts, so that all
may benefit by filtering on "Answered questions" and quickly finding the
right answers to similar questions. Remember that the best answers are often
given to those who have a history of rewarding the contributors who have
taken the time to answer questions correctly.
 
C

Chris2

altonomus said:
I posted yesterday about trying to use a MakeTable query to auto assign
College Weekenders to Students. You can get all the info from the post "How
do I use a record only once when making a table from a query?" posted on
3/6/05. I want to make sure that I am using the right query type. Also I
have not had much sucess with the code provided in the post.

Please provide the DDL (including CONSTRAINTS)
for all of the Tables involved. If the DDL is
not available, please include a well-formatted
text description (monospace-font) of the
relevant portions of the structures of each
Table, including a description of the Primary
and Foreign Keys (i.e. "relationships").
Please also include some sample data from each
table (enough rows from each table to allow
any needed Queries to be executed). Please
also include the expected output.


Sincerely,

Chris O.
 
C

Chris2

"'69 Camaro" <[email protected]_SPAM>
wrote in message
Hi.


A quick glance at some of the code that you may be having problems with
reveals SQL statements that assume your Majors field is a numeric
field.

Not having much to go on, I was guessing.


Sincerely,

Chris O.
 
G

Guest

Hi, Chris.
Not having much to go on, I was guessing.

That's all one can do. Of course, I would have used a numeric foreign key
in that field, too, but many people who use Access haven't yet discovered the
advantages of doing so and merely type the entire text string into the field
for every record. Creating a SQL statement with a string literal in the
WHERE clause can trip the unwary, so I'm guessing (!) that's where the OP is
having trouble.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts, so that all
may benefit by filtering on "Answered questions" and quickly finding the
right answers to similar questions. Remember that the best answers are often
given to those who have a history of rewarding the contributors who have
taken the time to answer questions correctly.
 

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