Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can data be entered into a Query?

Status
Not open for further replies.

ToshTrent

Technical User
Jul 27, 2003
209
As the title states

As I'm using VB to access the tables and the query has everything i need in it.

Cheers
Matt
 
If I'm understanding your question, and if it's a relatively basic select query...absolutely! (That is, you're not pulling info from multiple tables with joins...and even then you can enter data.) In my opinion, you almost always want to use a query to enter data into the field. Just pull your fields from the table in the query, and base the form on the query, and you're good to go.

Good luck!

-Patrick

Nine times out of ten, the simplest solution is the best one.
 
ToshTrent

Patrick is correct -- data can be entered when using a query provided appropraite fields are includeed in the query.

However, data integrity has to be maintained. If you have set up a table that requires a field to be entered (say a customer field) but the query does include that field, then the data entry will fail. (But this should not prevent a record from being edited.)

For a multiple table query, the anser is a little more "iffy". In general, you can enter data on either side of the one to many realtionship (but not both together) provided data integrity is maintained. Remember now that on the "many" side, the foreign key, the field linking the child to the parent is usually required. So it often makes sense to enter the parent record first, then the child.

That being said, many developers prefer not to enter data straight into the table. Likewise, entering data using a query has potential risks. The only data checking relies on how well you have defined your tables and relationships, and how you have forced referentail integrity. I have seen developers created tables without defining the relationships, but rely solely on the form for ensuring data integrity -- if they used the query method to add data, the risk of messing data integrity may be fairly high.

Richard

 
Thank you for your time gents, you were both very helpful!


[red]
Thankyou[/red]
Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top