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

Form/Subform-Stop navigation advance if no subform?

Status
Not open for further replies.

BobJacksonNCI

Technical User
Mar 11, 2003
725
US
Access 2000 / SQL 7

Experience level Novice, or maybe Novice plus

Using Form + Subform. Allowing view/edit existing records AND add new records on same form.

Problem: Using standard Access navigation buttons on the form (not subform). If the user is positioned on a new record and selects >, the form's record is stored and there is no subform record.

I'd like to not allow the navigation advance when there is no subform entry.

Thanks in advance!
Bob
 
Hi,

What you probably need to do is pick a field that will always have an entry if a new record is created i.e. primary key field.

Then add code to the oncurrent event of the form like this:

if isnull(txtField) then

cmdButton.enabled = false

end if


'txtField' should be the name of the text box that hold the primary key field or the filed that you chose

'cmdButton' should be the name of the command button to open the sub form.

Merry crimbo

Nowell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top