Combo problem - or ???

Andren

Registered User.
Local time
Today, 02:08
Joined
Sep 3, 2002
Messages
55
Hello!
I have a combo-box on a form based on a lock-up table. Depending of user choise a corresponding number is then passed to a table for storage. This works just fine.
BUT - when I decided to make this form a subform on a tabbed page (I did so by just dragging my form onto the tabbed page) my combo-box have gone crazy (or maybe it´s me).
I get the following message "You can´t assign a value to this object..." and then some suggestions on why.
However - I have checked all the "whys'". There is noting wrong with the tabbed page. It is nothing wrong with ta main page (containing the tabbed page) either.
Why does my combo alter it's behavior in this way ?
I really would appreciate any enlightment in this question.

/ Anders
 
Paste your code here. Most likely the challenge is resulting from turning the form into a subform. You'll have to change some syntaxes.
 
My friend... When you write code to a form, you often need to refer to the form or to controls on the form...If you decide to make the form a subform, then all references you've previously made need to be changed to include the main form name...In essence your form has a new name that includes the main form name....

Example:

original control reference....
Me.Control1 or
Forms!YourForm.Control1

original form reference after YourForm is added as subform to NewForm.....
Forms!NewForm!YourForm.Form.Control1

Anywhere you referred to the Form or its controls in your code needs to be changed for Access to know what you're talking about.
 
Thanks Rob and Casey for your answers.

I will post my code, and this is what puzzles me;
I have a lot of controls on my subpage and I manage to populate my tables and queries through the form - when I look at the code there are however no references like Casey suggested - and still it works !!! Only this combo is complaining like I explained in my first screame for help in this matter.

So why does it work without any relevant code written?
And do I have to declare every control - despite that the shit works ?? (excuse me for rude language but I´m starting to get annoyed about Access and myself also for that matter...)

Anyway here is the code:

Code for Tabbed page:

Option Compare Database
Private Sub cmdacCmdTabControlPageOrder_Click()
On Error GoTo cmdacCmdTabControlPageOrder_Click_Error

DoCmd.RunCommand acCmdTabControlPageOrder

Exit_cmdacCmdTabControlPageOrder_Click_Error:

Exit Sub

cmdacCmdTabControlPageOrder_Click_Error:

If Err = 2046 Or Err = 2501 Then
Resume Next
Else
MsgBox Err.Description
Resume Exit_cmdacCmdTabControlPageOrder_Click_Error
End If

********** end of code *******

code for subform dragged to tabbed page::

Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub

***** end of code *****

Code for form (before made to a subform on tabbed page).

Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub


***** end of code *****

I did not write these code-snippets - Access did (not my fault ...) .. and it worked for all controls EXCEPT this combo.
Therefore I got confused.


/
Anders
 

Users who are viewing this thread

Back
Top Bottom