P
Paul
Hi,
I'm useing the following code to allow users to enter a new record number in
a combobox and have that number added to the list:
Private Sub cmbRefID_NotInList(NewData As String, Response As Integer)
Response = acDataErrContinue
Dim db As Database
Dim rst As Recordset
Dim sqlTransRef As String
Set db = CurrentDb()
sqlTransRef = "SELECT [tbl46GHeader].[FormID], [tbl46GHeader].[RefID]
FROM [tbl46GHeader] Order by RefID Desc"
Set rst = db.OpenRecordset(sqlTransRef, dbOpenDynaset)
rst.AddNew
rst!RefID = NewData
rst.Update
rst.Requery
rst.Close
Response = acDataErrAdded
End If
End Sub
This works fine in that it adds the new record (RefID). The problem is that
this combobox also has an Afterupdate event which is used to update the form
with the record selected in the combobox. Whats happening is after the above
procedure runs the first record in the database is selected and the form is
populated with this data. How do I get the form to requery the table and
allow me to fill in the fields for the record create by the code above?
Thanks
I'm useing the following code to allow users to enter a new record number in
a combobox and have that number added to the list:
Private Sub cmbRefID_NotInList(NewData As String, Response As Integer)
Response = acDataErrContinue
Dim db As Database
Dim rst As Recordset
Dim sqlTransRef As String
Set db = CurrentDb()
sqlTransRef = "SELECT [tbl46GHeader].[FormID], [tbl46GHeader].[RefID]
FROM [tbl46GHeader] Order by RefID Desc"
Set rst = db.OpenRecordset(sqlTransRef, dbOpenDynaset)
rst.AddNew
rst!RefID = NewData
rst.Update
rst.Requery
rst.Close
Response = acDataErrAdded
End If
End Sub
This works fine in that it adds the new record (RefID). The problem is that
this combobox also has an Afterupdate event which is used to update the form
with the record selected in the combobox. Whats happening is after the above
procedure runs the first record in the database is selected and the form is
populated with this data. How do I get the form to requery the table and
allow me to fill in the fields for the record create by the code above?
Thanks