Work Around for Update? 
Author Message
 Work Around for Update?

I have an Unbound combo box that I am using display table data. The problem
I am having is that when I try to set the combo.text property I get an error
saying that " .... a before update or after update procedure....blah, blah,
blah....is preventing Access from updating the records...blah, blah,
blah...change it you idiot."

At first I figured this was because I had the combo bound to the table so I
went with unbound. No difference. So I decided that if I created a separate
array and stored the values of the table in this array I could use the array
in combination with filling the combo from a function. This way the combo
box would have no direct connection to any tables and I could set its text
property with generating the error. See code... (note: the variable
JobEntries is previously set to the record count)

............................................................................
............................................................................
...........

Set db = CurrentDb

        With db

            Set Temprecs = .OpenRecordset("SELECT JobNumbers.* FROM
JobNumbers ORDER BY JobNumbers.JobNum", dbOpenDynaset)

            With Temprecs

                For i = 0 To JobEntries - 1        'fill the JobRecs array
with values from the
                                                                'forms
recordsource field JobNum

                     JobRecs(i) = Temprecs![JobNum]
                    .MoveNext

                Next i

                .Close

            End With

            .Close

        End With

............................................................................
............

and combo fill function

............................................................................
.............

Function NumList(fld As Control, id As Variant, row As Variant, col As
Variant, code As Variant) As Variant

    Dim ReturnVal As Variant

    ReturnVal = Null

    Select Case code

        Case acLBInitialize         ' Initialize.

            ReturnVal = JobEntries

        Case acLBOpen                       ' Open.
            ReturnVal = Timer               ' Generate unique ID for
control.

        Case acLBGetRowCount                ' Get number of rows.
            ReturnVal = JobEntries

        Case acLBGetColumnCount     ' Get number of columns.
            ReturnVal = 1

        Case acLBGetColumnWidth     ' Column width.
            ReturnVal = -1                  ' -1 forces use of default
width.

        Case acLBGetValue                   ' Get data.
            ReturnVal = JobRecs(row)

        Case acLBEnd                        ' End.

    End Select

    NumList = ReturnVal
End Function

............................................................................
.....................................

 Well, I did all this and it works except that I still get the same error
when I try to set the combo.text property.

I can simply have it "on error resume next" but this causes other problems
later on because there will actually be several combos filled by different
tables on the form and I will have to be able set their text property from
code at certain times. Having all those "On error resume next" 's in the
code gets to be very troublesome.

So does anyone no of anyway around this? At first I tried setting

combo.text = me![JobNum]

I thought this might be part of the problem because it referenced a feild in
the table so I tried

combo.text = JobRecs(Hold)

I wont take the time to explain this last one, except that it works to give
me the proper combo.text, but it still generates the error! ARGH!!!!

Can anyone help?



Wed, 25 Dec 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Work Around for Update

2. Work Around doesn't work for RichTextBox

3. Getting around Outlook E-mail security update

4. Opening .CSV file from VBA mis-converts SOME dates - how to work-around

5. Working around security

6. Work Around for AutoMail Send

7. work around for rich text puzzle

8. WorkGroup Work-Around

9. Working around GetAddress?

10. Document Map View work around?

11. AD search error work-around?

12. Working around screen scar

 

 
Powered by phpBB® Forum Software