Home > Net >  Create New Record statement on Record Next button
Create New Record statement on Record Next button

Time:11-09

I have a quick question about adding an if clause on one of my buttons.

I have the general "Cycle Next" button running VBA on most of my user forms, but my users have a bad habit of using it to create a new record instead of using the "New Record" button.

Is there any way to do a check to see if they're on the last record & if so, create a new record using my call "New Record" VBA?

Normally it wouldn't be an issue, but I have specific VBA that runs on the "New Record" button that needs to be added to the form & they have a bad habit of spamming the "Cycle Next" button creating like 3-4 unnecessary new records. I'll probably add in a message box so that tells them they're creating a new record to fix that issue.

Any help would be appreciated.

Ive looked around & haven't really found any other posts or forums that have had the same issue. I'm sure it's probably an easy addition in the VBA, but i don't know enough VBA for what to add in.

CodePudding user response:

Use the OnCurrent event of the form:

Me!CycleNextButton.Enabled = (Me.CurrentRecord <> Me.RecordsetClone.RecordCount)
  • Related