GoToRecord / OnLoad event of form

Petros

Registered User.
Local time
Tomorrow, 00:15
Joined
Jun 30, 2010
Messages
145
Hi All,

I have an issue with GoTorecord,,,New, on a forms onload event..

Form A. Control 1 (Primary Key). Table 1. On the click event of command button “create new record” i open Form B, table 2

Table 1 and Table 2 have RI Control1/Table1 – Control/Table2

Form A remains open and visible

On Form B’s onload event i use

Me.Control_1 = Forms![FormA].[Control_1]
GoToRecord,,,New,

But i do not receive a new unique identifier (Table2, ID)..what am i doing wrong..Should form B be a subform to FormA..is it possible to create a new record programmatically with out
Subform/Form?

Hope i managed to explain my issue well / Thanks!
 
You won't get a new autonumber until you start entering some data into the fields. At that point it will show up.
 
Unfortunatly this is not the case boblarsson..
i receive the error, you can not assign a value to this form..



Thanks!
 
Unfortunatly this is not the case boblarsson..
i receive the error, you can not assign a value to this form..



Thanks!
Can you type a value in manually? It sounds like perhaps the recordset underlying the form might not be updateable.
 
Yes i can type in a value, but the form will not save those values...
Perhaps its best to create a new form and then include the Form B as a subform...

i was hoping not to do this..
 
..strange enough..i receive the ID when i move out of focuse from the form..
 
but unfortuantly i can not save the record since i recieve a an Error message
"May entoundered an error"..my backend is on SQL...
 
If the backend is in SQL Server, the tables MUST have a Primary Key defined. Do they all?
 
Oh, and I believe SQL Server isn't going to serve up the ID field until you save the record. As I mentioned in my previous post - you must have primary keys defined on your SQL Server tables or else you can't update from Access.
 
Yes, primary key is defined..i just dont get it..

"I have an issue with GoTorecord,,,New, on a forms onload event.." should assign a new ID
 
Have you tried this instead:

Code:
DoCmd.RunCommand acCmdRecordsGoToNew
 
:-) i must be the most stup... guy around..i did not assign the Identity Specification of the Primary key..and yes boblarsson..i just realized that to the contrary of Access db..the SQL assigns this value on the update of the record..i.e,,all fields needs to allow null values...

i will get a heart failure because of this migration :-)

Thanks a lot..once again!
 

Users who are viewing this thread

Back
Top Bottom