Ahhhh! This form is killing me!

back2basic

Registered User.
Local time
Today, 14:07
Joined
Feb 19, 2013
Messages
113
Please help me understand!

I have an unbound ComboBox which I am using to allow a user to select a record. On "click" the CB calls code so I can use the info in the combo box to populate text boxes in the form. Ok, it works great for a split second but as soon as I move to the next field of the form which calls more code on event "After Update", all of my text boxes revert back to the information of the first record in the table.
 
The choice of finding the record (OnClick) is not the right method.. It should be inside AfterUpdate.. Along with the other code..
 
I have tried to solve this problem using "AfterUpdate". I had the same issue that's why I tried "onclick"Same problem. It is clearly a timing issue in the display and perhaps it is in the way I am updating my fields. Is it OK to equate text boxes to a lookup as follows:

In my text box properties I have the Control Source =[cboAsset_ID].[column](9)
and so on for each field I want to display. In this case does it matter. At what point does the form display these text boxes?
 
You can use to set the value using the Form_Current method..
Code:
Private Sub Form_Current()
    If Me.ComboBoxName.ListIndex <> -1 Then
        Me.TextBoxName = Me.ComboBoxName.Column(8)
    End If
End Sub

Private Sub ComboBoxName_AfterUpdate()
   [COLOR=Green] 'your code to navigate to Record.[/COLOR]
End Sub
 
Thank you does this mean the Control Source of the text box should now be Null? or know an unbound text box?


You can use to set the value using the Form_Current method..
Code:
Private Sub Form_Current()
    If Me.ComboBoxName.ListIndex <> -1 Then
        Me.TextBoxName = Me.ComboBoxName.Column(8)
    End If
End Sub

Private Sub ComboBoxName_AfterUpdate()
   [COLOR=Green] 'your code to navigate to Record.[/COLOR]
End Sub
 
If you're populating your Controls using things like

=[cboAsset_ID].[column](9)

not only is your Combobox Unbound, but your entire Form is Unbound!

The standard way of retrieving Records, using a Combobox, is to

  • Create a Bound Form using your Table/Query as the Record Source.
  • Go to the Field List and drag the Fields you want retrieved onto the Form
  • Place a Combobox on the Form.
When the Combobox Wizard comes up:

  • Select "Find a record on my form based on the value I've selected..."
  • Click on Next
  • Select the appropriate identifying field to appear in the Combobox
  • Click on Next
  • Size the Combobox column
  • Click on Next
  • Name the Combobox
  • Click on Finish
Now the user can use the dropdown arrow of the Combobox to retrieve the data or simply start typing the identifying data in and the Combobox will start to autocomplete the entry. When the correct entry is found hit <Enter> and the appropriate data should be retrieved.

Linq ;0)>
 
I am sorry Pr2. I hate to be ignorant and am learning but this test is failing: so my fileds are not updating. What does this test do and where is it?

Code:
If Me.cboAsset_ID.ListIndex <> -1 Then
 
I agree, and you are correct...for the most part. These controls are unbound (5 out of 7 of them) because they are information only for the user. No data should or will be entered in these fields. They are disabled and locked. The only data I want the user to enter on this form is a number (for materials being returned) and a date. These two fields are bound to my returned materials table

In any event, If I bind the Combobox to a PK for example, (because I have multiple fields from different tables), referential integrity will not let me select the information. Hope this makes sense.

If you're populating your Controls using things like

=[cboAsset_ID].[column](9)

not only is your Combobox Unbound, but your entire Form is Unbound!

The standard way of retrieving Records, using a Combobox, is to


  • Create a Bound Form using your Table/Query as the Record Source.
  • Go to the Field List and drag the Fields you want retrieved onto the Form
  • Place a Combobox on the Form.
When the Combobox Wizard comes up:

  • Select "Find a record on my form based on the value I've selected..."
  • Click on Next
  • Select the appropriate identifying field to appear in the Combobox
  • Click on Next
  • Size the Combobox column
  • Click on Next
  • Name the Combobox
  • Click on Finish
Now the user can use the dropdown arrow of the Combobox to retrieve the data or simply start typing the identifying data in and the Combobox will start to autocomplete the entry. When the correct entry is found hit <Enter> and the appropriate data should be retrieved.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom