Value to Combo Box

honey2wood

Registered User.
Local time
Today, 06:19
Joined
Feb 16, 2010
Messages
43
Hi Everyone,

I hope someone can help I seem to be going round in circles at the moment.
I am taking a value from one form into another. The value I am taking needs to select an item In a combo Box.

So far I can move the value to the new form but cant seem to copy the value into the combo box.

Private Sub Use_By_Date_Click()
Dim Partno As String
Partno = Me.Form.TRAN_ItemNo
TRAN_ItemNo = Partno
'MsgBox Partno
DoCmd.OpenForm "Frm_Stock_Transactions"
DoCmd.GoToRecord , , acNewRec


End Sub

This works but then I have tried
me.Component Value = Partno
me."Frm_Stock_Transactions"."Component Value" = Partno
Form."Frm_Stock_Transactions"."Component Value" = Partno
and various combinations of the above but cant seem to get it right.
Is this the right way to do it or is there an easier way.

Thanks in anticipation

Graham
 
  1. Try to use code tags when you post - it makes your code stand out, and keeps the website from erasing your indenting.
  2. If you aren't, start indenting your code. It makes it MUCH more legible.
  3. You should never use spaces in table and field names. It makes life tougher all around when you do.
  4. When referring to a control on a different form, you need to use this format:
    Code:
    Forms!FormName!ControlName
  5. HERE is a handy link for referring directly to forms, subforms, and controls on those forms and subforms.
 
Very Many thanks that works just right.

I know what you mean about field names and normally I do try. In this case I am adjusting someone else's database and don't want to change much in case it stops other parts from working.

Kind regards
Graham
 

Users who are viewing this thread

Back
Top Bottom