open args read only field

krowe

Registered User.
Local time
Yesterday, 22:44
Joined
Mar 29, 2011
Messages
159
Hi

I have an 'add new' button on a form that opens a defferent form and passes through the ID value using the openargs, here is the code:

Code:
Dim stDocName As String
    Dim strOpenArgs As String
    
    stDocName = "frmRIAProcessAdd"
    strOpenArgs = Me.ID
    DoCmd.OpenForm stDocName, , , , , , strOpenArgs
    DoCmd.Close acForm, "frmRIASelectApplication", acSaveYes

the form that opens has the following on the on load event:

Code:
OpenArgs = Me.ID

I get the runtime error 2135, this property is read-only and can't be set.

How do I make the ID field writable?

Thanks
 
Hi

I get 'you cant assign a vlaue to this object' if i try that.
 
What is the Data Type of the field "ID"? Is it an AutoNumber?
 
Hi
The string ID is passed by the openargs method to the new form and is stored in new form parameter me.openargs.
So in the new form you need to assign
me.yourfield = me.openargs
Yourfield must be a string in this case or it will be the wrong data type (I think)

Tim
 
Why is an ID, which I think is a Number/Long/Integer assigned to a variable that is declared as String?
Code:
Dim strOpenArgs As String
 
wow, lots of responces, you are all on form today, thanks!

data type is an autonumber field, I think this may be the problem, but I need to filter to the number im passing through.

me.ID=me.openargs gives the error can't assign a value to this object too :(

i thought strOpenArgs is a string in the context i used it in the code :/
 
OpenArgs need not always be String, if you wish to pass number you can.. Try replacing the Dim statement with Long and see what happens..
 

Users who are viewing this thread

Back
Top Bottom