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!

Query returning blank record

Status
Not open for further replies.

kcmark

Technical User
Nov 2, 2002
63
US
I have a query that is bringing in the exact data I want, but it is also including 1 extra line item with blank amounts. I have compared it to another query of the same table which is working correctly, but I cannot find any differences in the settings. Any ideas?
 
kcmark

I suspect you are retrieving data into a contineous form. If so, the blank line if where the system is expecting data entry. You can "fix" this by using the property of the form called "AllowAdditions" and set it No / False. This property can be set on the form itself, or programatically.

Me.AllowAddtions = False

Now, you will probably wonder how to add new data. You can add a command button, and use the wizard for "Record Operations" -> Add new record.

You may have to enable Me.AllowAddtions = True to get this to work.

Next, if this is for a subform, you can still put the buttons on the subform, or work from the main form and reference the subform.
 
...I forgot to add.

A query will return a recordset, but it depends on the recordset whether you can edit or not edit the recordset. A complex query will jeprodize data integrity if it allowed adding new records. For example, trying to add a new invoice detail record without first creating / referencing the invoice header record. For a simple query, where all the info is available, there is no data integrity issue and the recordset can be edited or added to.
 
I fixed the problem - the fields I was trying to display were not 'locked' - once I changed that it worked fine - Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top