UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Adding new record with allow additions set to no    
 
   
loneblade
post Aug 4 2008, 03:50 PM
Post #1

UtterAccess Enthusiast
Posts: 57



Is there anyway to set a continuous form's allow additions property to No, yet insert a new record through vba?

I get a runtime error 2105, "you can't go to the specified record", with my current code.

Thanks
Go to the top of the page
 
+
rsindle
post Aug 4 2008, 03:57 PM
Post #2

UtterAccess VIP
Posts: 1,402
From: Northern Virginia



You can always generate the record in code, append it via SQL, then requery the form.

Or, if you want them to be able to add a row manually. Put a button that will enable the New record.

Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec

THen in the AfterUpdate event of the form, turn off the AllowAdditions property:

Me.AllowAdditions = False

Rob
Go to the top of the page
 
+
ace
post Aug 4 2008, 04:30 PM
Post #3

UtterAccess VIP
Posts: 5,283
From: Upstate NY, USA



Well you won't be able to go to an empty row to add values
if AllowAdditions is set to no so I you'll have to explain where
you want to enter values for the new record.

Popping up an entry form is a reasonable thing to do.
Go to the top of the page
 
+
rsindle
post Aug 4 2008, 04:40 PM
Post #4

UtterAccess VIP
Posts: 1,402
From: Northern Virginia



Either of these 3 will work.
1. Compute in code and insert via SQL and requery the form (my example1)
2. Enable allowAdditions, edit, turn it off (my example2) (for manual input)
3. Open a data entry form (Ace's example). (for manual input)

HTH,
Rob
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 01:54 PM