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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUBFORM'S RECORDSET "NULL"

Status
Not open for further replies.

Angelique

Technical User
Mar 9, 2001
127
0
0
AU
I have a form with a listbox of overdue clients and a subform that displays those clients the user selects for printing an Overdue letter.

All goes well until the user selects the &quot;<&quot; command button when there is a Null/empty value in the table. I need to prevent the user from triggering an error &quot;2427&quot;.

Any suggestions?


Angelique
 
This is a bit of a fudge but it may work.

You can trap the error (have a specific error trap for this error) then put up a message box.

What does the < button do? More info may help.
 
ImpMan,

The code behind the < button actually deletes the records in a table where ClientID = Forms!frmReminder![frmClientSelected].Form![ClientID]

If there is no value in tblClientSelect.ClientID then it triggers the error.

From the user's view, it just removes the records they don't want anymore and returns it to the listbox.

Angelique
 
I am still a bit confused,

1. What is the text associated with the error message?
2. I assume that you are adding the record to a table when the user selects it on the list box. The subform record source is a the table the data has been added to. Right?
3. Do you get the problem only when the last record has been deleted from the subform, or is it when any record is deleted.
4. What properties do you have set for the table. Do you have anything special set up that is not allowing you to delete this record successfully?
5. Do you add and remove rows from the list box. Could the fault originate from adding the record back to the list box?
6. This is just an idea. How about setting a check box to indicate that you want this record to appear in the subform. Then you don't have to delete, add records many times, just requery the subforms, listboxes etc.
 
1. Run-time error 2427 &quot;You entered an expression that has no values. With error handling for &quot;cancel&quot; I get &quot;Extra ] in query expression '((tbleClientSelect.ClientID=))'

2. When the user select from the listbox, the selection ClientID is inserted into an empty record with the ID (autoNumber).

3. Yes! I get the error when there is no longer a valid value in the field ClientID in the tbleClientSelect table. The &quot;<&quot; command button deletes the valid entry out of the tblClientSelect and therefore triggers the error if the user becomes over zealous and clicks the &quot;<&quot; command button too fast.

4. I wasn't aware that moving items from one listbox to another was an issue, the fact that I am moving from a listbox to a subform by inserting into the table and removing the count of the listbox and visa versa should produce this error.

Angelique


 
In reply to 3. above.

Am I correct in saying that the error only appears when there is no records in the table, and then the user presses the record delete button.

If this is the case then how about disabling this button when there are no records available to delete.

In reply to 4. above.
There shouldn't be a problem with anything that you are doing (in theory). I am meerly trying to track down the correct cause of the error. It isn't easy to get the full picture without alot of information.

By the way, it is nearly the weekend so I may not reply for a couple of days.
 
ImpMan,

What time off! just because it's the beginning of the weekend? I probably get a few hours off for good behaviour!

I will give &quot;disabling the &quot;<&quot; command button a go.

Back to the coding.


Angelique

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top