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

Updating record before dcount in code. 1

Status
Not open for further replies.

bhoran

MIS
Nov 10, 2003
272
US
I have a form that allows users to update info. This automatically pops up all records with a null in a particular field and allows updating via a combo box.

I then check the table for nulls (using Dcount) again when they try to close it and don't allow close where a null still exists.

The problem I have is that the table is not updated until the control has been exited, therefore the Dcount is incorrect where the user has not exited the last control they are on. I have tried adding a goto next record command but this doesn't work where the records in question is the last record.

How do I make sure the records are updated before I perform the Dcount?

Thanks for any help.
 
How is the user trying to exit the form? Are they just exiting out, and you are running the code on the exit proceedure?

If so, can you do an if before you dcount?

If (forms.Whatever.dirty)
save record

Or even easier, change your code so it closes the form for the user, then checks for nulls, and if any are found, reopen the form.

ChaZ



Ascii dumb question, get a dumb Ansi
 
You can also insert the following line of code before your DCount.


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70



This forces the current record to save.

Alec Doughty
Doughty Consulting P/L

"Life's a competition. Play hard, but play fair"
 
Thanks Faeryfyrre that is exactly what I am after.

Thanks to you also Blorf the prob with closing the form and reopening is that the records updated already are not displayed, I would prefer if thay did stay available for update.

Thanks again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top