General discussion

Locked

Access Open DataEntry Form

By Glenda Gable ·
I have created 2 forms. The first for searching records, the other strickly for data entry.

I am using an unbound text box to AutoFill 3 fields (from the data from the previous record) using the OnCurrent event.

My problem is when I open the data entry table it does not have a previous record to draw information from, therefore I get an error message that the OnCurrent event basically cant perform correctly. My brain is not working, is there a way of NOT running the OnCurrent on openingthe form? or dont run it first (or until there is a record added.. ), or skip the event once, etc...?

Thanks,
Glenda

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Access Open DataEntry Form

by sl-campbell In reply to Access Open DataEntry For ...

I would use an IF statement in the OnCurrent to check if the forms underlying table or recordset contains data or not (EOF and BOF) and first when then condition shows that there are records, then the code with-in the IF statement executes.

To keep the OnCurrent event from executing, which is what you are asking for, is not possible - you can only set a module level boolean variable, such as bFirstTime, and set it to True in the Form_Open or Form_Load event and in the OnCurrent event check if it is true and if so then set it to False and exit sub, otherwise continue with the code remaining code in the event.

If bFirstTime then
bFirstTime=false
Exit Sub
else
MoreCode....
end if

Hope this helps!

Collapse -

Access Open DataEntry Form

by Glenda Gable In reply to Access Open DataEntry For ...

Poster rated this answer

Collapse -

Access Open DataEntry Form

by Glenda Gable In reply to Access Open DataEntry For ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums