Pardon me, I've used Access for 1-year & lost all of my little notes. Can someone please give me the code for a Form to open to a New Record upon opening a Form?
I will greatly appreciate it & thanks in advanced!
Pardon me, I've used Access for 1-year & lost all of my little notes. Can someone please give me the code for a Form to open to a New Record upon opening a Form?
I will greatly appreciate it & thanks in advanced!
One way:
DoCmd.OpenForm "form name", , , , acFormAdd
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Or, if you're opening the Form directly, rather than from another Form:
Code:Private Sub Form_Load() DoCmd.GoToRecord , , acNewRec End Sub
Linq ;0)>
Thanks Ling, that's the code I was looking for except I cannot open my VBA. It says, "Unexpected error, quitting." Could the whole db be corrupted?
Sorry, but what, exactly, does "I cannot open my VBA" mean?
Exactly what are you doing when you get that message?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Ling: I get a message saying, "Unexpected error, quitting" as I stated above.
June: I get 2-choices, either "OK" which gets me no where or "Help" & directs me to this website, https://msdn.microsoft.com/en-us/lib...ffice.15).aspx that doesn't tell me anything.
No, you haven't! You said "I cannot open my VBA" which doesn't really isn't clear. Do you get the message when you try to go into the VBA code behind your Form? Do you get it when you try to simply open your Form? 'Open my VBA' doesn't really make since.
Ling, please except my apology, I meant went i click on, "View Code" under the Design ab in Form Design View. I thought clicking on, "View Code" opens up the VBA Window? Maybe I'm mistaking the two?
Yes, it should open up the VBA module for the Form! That would suggest that corruption has reared its ugly head! First line of defense is to
- Create a new, blank database file
- Import everything from the errant database into the new database file
- Try running the new database
Linq ;0)>