Run-time error when opening a form

  • Thread starter Thread starter Amit
  • Start date Start date
A

Amit

Using Access 2K, Win XP.
~~~
Hi,

I'm opening a form (frmGroupComm - based on table
tblGroupComm) by clicking on a button in another form
(frmProject - based on table tblProject). ProjectID is the
Primary key in tblProject, and ProgramID is the Foreign
Key in both the tables.

The code for OnClick event in frmProject is:
==
DoCmd.OpenForm stDocName, , , , acFormAdd, , Me![ProgramID]
==

The code for OnOpen event in frmGroupComm is:
==
Private Sub Form_Open(Cancel As Integer)
If (OpenArgs <> "") Then
Me.cboProgramID_frmGroupComm = OpenArgs
End If
End Sub
==

frmGroupComm is based on a query that selects all the
fields from the table tblGroupComm, and the combo-
box "cboProgramID_frmGroupComm" lists the Program Names
and their IDs, and has ProgramID as the Control Source.

Error:

When I click on the button to open frmGroupComm, I get the
following error:

Run-time error '-2147352567 (80020009)':
You can't assign a value to this object.
==

I've used similar logic and code in other forms, and it
seems to be working fine, and I'm not able to figure out
why I'm getting this error, and how to fix it.

Any help will be much appreciated.

Thanks!

-Amit
 
That worked!!! But, I still don't know why it didn't work
in OnOpen event. If you can explain that, I'll appreciate
it. And, hope you enjoy your holidays!!

Thanks!

-Amit
-----Original Message-----
Try using your Load event, instead of the Open event.

HTH
- Turtle

Using Access 2K, Win XP.
~~~
Hi,

I'm opening a form (frmGroupComm - based on table
tblGroupComm) by clicking on a button in another form
(frmProject - based on table tblProject). ProjectID is the
Primary key in tblProject, and ProgramID is the Foreign
Key in both the tables.

The code for OnClick event in frmProject is:
==
DoCmd.OpenForm stDocName, , , , acFormAdd, , Me! [ProgramID]
==

The code for OnOpen event in frmGroupComm is:
==
Private Sub Form_Open(Cancel As Integer)
If (OpenArgs <> "") Then
Me.cboProgramID_frmGroupComm = OpenArgs
End If
End Sub
==

frmGroupComm is based on a query that selects all the
fields from the table tblGroupComm, and the combo-
box "cboProgramID_frmGroupComm" lists the Program Names
and their IDs, and has ProgramID as the Control Source.

Error:

When I click on the button to open frmGroupComm, I get the
following error:

Run-time error '-2147352567 (80020009)':
You can't assign a value to this object.
==

I've used similar logic and code in other forms, and it
seems to be working fine, and I'm not able to figure out
why I'm getting this error, and how to fix it.

Any help will be much appreciated.

Thanks!

-Amit


.
 
As I understand it, first the form is opened, then the data is loaded into
the controls.
Until the form is ready to receive data, you can't assign a value to a
control.

HTH
- Turtle

Amit said:
That worked!!! But, I still don't know why it didn't work
in OnOpen event. If you can explain that, I'll appreciate
it. And, hope you enjoy your holidays!!

Thanks!

-Amit
-----Original Message-----
Try using your Load event, instead of the Open event.

HTH
- Turtle

Using Access 2K, Win XP.
~~~
Hi,

I'm opening a form (frmGroupComm - based on table
tblGroupComm) by clicking on a button in another form
(frmProject - based on table tblProject). ProjectID is the
Primary key in tblProject, and ProgramID is the Foreign
Key in both the tables.

The code for OnClick event in frmProject is:
==
DoCmd.OpenForm stDocName, , , , acFormAdd, , Me! [ProgramID]
==

The code for OnOpen event in frmGroupComm is:
==
Private Sub Form_Open(Cancel As Integer)
If (OpenArgs <> "") Then
Me.cboProgramID_frmGroupComm = OpenArgs
End If
End Sub
==

frmGroupComm is based on a query that selects all the
fields from the table tblGroupComm, and the combo-
box "cboProgramID_frmGroupComm" lists the Program Names
and their IDs, and has ProgramID as the Control Source.

Error:

When I click on the button to open frmGroupComm, I get the
following error:

Run-time error '-2147352567 (80020009)':
You can't assign a value to this object.
==

I've used similar logic and code in other forms, and it
seems to be working fine, and I'm not able to figure out
why I'm getting this error, and how to fix it.

Any help will be much appreciated.

Thanks!

-Amit


.
 
Gotcha!

Thanks, and happy year 2004!

-Amit
-----Original Message-----
As I understand it, first the form is opened, then the data is loaded into
the controls.
Until the form is ready to receive data, you can't assign a value to a
control.

HTH
- Turtle

That worked!!! But, I still don't know why it didn't work
in OnOpen event. If you can explain that, I'll appreciate
it. And, hope you enjoy your holidays!!

Thanks!

-Amit
-----Original Message-----
Try using your Load event, instead of the Open event.

HTH
- Turtle

Using Access 2K, Win XP.
~~~
Hi,

I'm opening a form (frmGroupComm - based on table
tblGroupComm) by clicking on a button in another form
(frmProject - based on table tblProject). ProjectID
is
the
Primary key in tblProject, and ProgramID is the Foreign
Key in both the tables.

The code for OnClick event in frmProject is:
==
DoCmd.OpenForm stDocName, , , , acFormAdd, , Me! [ProgramID]
==

The code for OnOpen event in frmGroupComm is:
==
Private Sub Form_Open(Cancel As Integer)
If (OpenArgs <> "") Then
Me.cboProgramID_frmGroupComm = OpenArgs
End If
End Sub
==

frmGroupComm is based on a query that selects all the
fields from the table tblGroupComm, and the combo-
box "cboProgramID_frmGroupComm" lists the Program Names
and their IDs, and has ProgramID as the Control Source.

Error:

When I click on the button to open frmGroupComm, I
get
the
following error:

Run-time error '-2147352567 (80020009)':
You can't assign a value to this object.
==

I've used similar logic and code in other forms, and it
seems to be working fine, and I'm not able to figure out
why I'm getting this error, and how to fix it.

Any help will be much appreciated.

Thanks!

-Amit



.


.
 
Back
Top