Combobox

rnutts

Registered User.
Local time
Today, 02:21
Joined
Jun 26, 2007
Messages
110
Hi

I have a combo box on my form (frmclientpricingenter) which pulls up a
record and displays the record on form.
I want to enter a value into the combobox, using code, from another form and
then the combobox pulls up the appropriate record.
I am able to populate the combobox but it wont pull up the required record.
If I manually select the record using the combobox it works fine.
Code for Combo box is as follows

Private Sub Combo9_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Client Name] = '" & Me![Combo9] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Code to open the form with a new record andpopulate the combobox with a value

Private Sub cmdaddpricing_Click()
On Error GoTo Err_cmdaddpricing_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmmtclientpricingenter"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Forms!frmmtclientpricingenter![Combo9].Value =
Forms!frmassistcliententry![Client Name]

Exit_cmdaddpricing_Click:
Exit Sub

Err_cmdaddpricing_Click:
MsgBox Err.description
Resume Exit_cmdaddpricing_Click

End Sub

Am I using the wrong event on the combo box

Thanks

Richard
 
Am unsure of what you mean. Have changed to code as follows
Forms!frmmtclientpricingenter![Combo9].DefaultValue =Forms!frmassistcliententry![Client Name]
Now the combo box is showing #Name

Please could you give a bit more detail, newish to access

Thanks

Richard
 
I was trying to be too clever and too complicated

Thanks for the help
 

Users who are viewing this thread

Back
Top Bottom