run-time error 3022

G

gymphil

I am using a combo box on a form to find existing records / add new records.
If I make it bound I get run-time error 3022, the changes you requested to
the table were not successfull because they would create duplicate values in
the index, primary key or relationship.
If I make the combo box unbound the first time a record is selected data
relating to that record is correct, but if I then scroll/tab through the
remaining records on the form the combo box does not change which is
misleading!, I think this is because it is unbound. I have tied afterupdate,
beforeupdate and lost focus. Can anyone help please!

Thanks
Phil

Private Sub Combo14_AfterUpdate()

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[productID] = '" & Me![Combo14] & "'"
Me.Bookmark = rs.Bookmark

End Sub
 
B

Brendan Reynolds

gymphil said:
I am using a combo box on a form to find existing records / add new
records.
If I make it bound I get run-time error 3022, the changes you requested to
the table were not successfull because they would create duplicate values
in
the index, primary key or relationship.
If I make the combo box unbound the first time a record is selected data
relating to that record is correct, but if I then scroll/tab through the
remaining records on the form the combo box does not change which is
misleading!, I think this is because it is unbound. I have tied
afterupdate,
beforeupdate and lost focus. Can anyone help please!

Thanks
Phil

Private Sub Combo14_AfterUpdate()

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[productID] = '" & Me![Combo14] & "'"
Me.Bookmark = rs.Bookmark

End Sub


Leave the combo box unbound and assign the value of the current product id
to the combo box in the Current event procedure of the form ...

Me.Combo14 = Me.productID
 
G

gymphil

Brendan

Brilliant! just the job, much appreciated

Phil

Brendan Reynolds said:
gymphil said:
I am using a combo box on a form to find existing records / add new
records.
If I make it bound I get run-time error 3022, the changes you requested to
the table were not successfull because they would create duplicate values
in
the index, primary key or relationship.
If I make the combo box unbound the first time a record is selected data
relating to that record is correct, but if I then scroll/tab through the
remaining records on the form the combo box does not change which is
misleading!, I think this is because it is unbound. I have tied
afterupdate,
beforeupdate and lost focus. Can anyone help please!

Thanks
Phil

Private Sub Combo14_AfterUpdate()

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[productID] = '" & Me![Combo14] & "'"
Me.Bookmark = rs.Bookmark

End Sub


Leave the combo box unbound and assign the value of the current product id
to the combo box in the Current event procedure of the form ...

Me.Combo14 = Me.productID
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top