After Update and Not In list

thart21

Registered User.
Local time
Today, 04:45
Joined
Jun 18, 2002
Messages
236
Is this possible on the same form?

I have a combo box which, when a part number is selected fills in 5 other text boxes in the After Update event like..

Me.rev = Me.partnumber.Column(2) etc.

I want to use the same form to add new records, have my "not in list" code working on my main field "partnumber" but, since I have the above in my After Update event, it's looking for all of the other fields which obviously are not entered in yet?

Do I need to create another form just for adding new records? I'd like to avoid that if possible.

Thanks!
 
Just found in my Access 2000 Dev Book that After Update events CANNOT be cancelled, I'll have to find another route.
 
Nothing like starting and ending my own thread! :)

Got it-changed my After Update code to ADO and I can now add new records with no conflicts.

On Error Resume Next

Dim rs As ADODB.Recordset
Dim strSQL As String

partnumber.SetFocus
If partnumber.Value > 0 Then
strSQL = "SELECT * FROM tblCables WHERE cableid = " & partnumber.Value

Set rs = CreateObject("ADODB.Recordset")
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open strSQL, CurrentProject.Connection

If rs.State = 1 Then
If Not rs.BOF Then
Me.cableid = rs("cableid")
Me.rev = rs("rev")
Me.description = rs("description")
Me.program = rs("program")
Me.supplier = rs("supplier")

End If
rs.Close
End If
Set rs = Nothing
End If
 

Users who are viewing this thread

Back
Top Bottom