Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update form after selecting from combo box

Status
Not open for further replies.

kcmorrissey

Technical User
Apr 14, 2005
15
0
0
GB
I have an 'add new order' form which opens with all the fields blank and focus set to a combo box.
The first thing the user must do it select a contract name or number from the unbound combo box. I then want the form to update and show all the relavent information in the form fields. - How do I do this.

At the moment the form is very static and I can't get the records to update.

Thx.
KEv
 
You should have all the information in the combobox (no matter column width set to Zero) then
[tt]
Private Sub ComboBox1_AfterUpdate()
Me.TextBox1.Value = Me.ComboBox1.Column(0)
Me.TextBox2.Value = Me.ComboBox1.Column(2)
End Sub
[/tt]

________________________________________
Zameer Abdulla
Visit Me
A child may not be able to lift too much.
But it can certainly hold a marriage together
 
Thx Zameer,

I did that but access tells me that I don't have a join key in my record set.
(See attached screengrap of message.)

I have 11 fields on this combo box only the contract number is visable all others are set to 0cm width.

My code looks like this:
Code:
_________________________________________________
Private Sub ProjectContractNum_AfterUpdate()
    Dim sOrder_idSource As String
    Dim rs As Object
    ProjectName = ProjectContractNum.Column(1)
    proj_status = ProjectContractNum.Column(2)
    proj_rudd_site_mgr = ProjectContractNum.Column(3)
    proj_rudd_site_tel = ProjectContractNum.Column(4)
    proj_rudd_site_fax = ProjectContractNum.Column(5)
    Proj_del_addr_1 = ProjectContractNum.Column(6)
    Proj_del_addr_2 = ProjectContractNum.Column(7)
    Proj_del_addr_town = ProjectContractNum.Column(8)
    Proj_del_addr_region = ProjectContractNum.Column(9)
    Proj_del_addr_postcode = ProjectContractNum.Column(10)
         
    sOrder_idSource = "SELECT orders_table.order_id  " & _
                        "FROM orders_table  " & _
                            "WHERE orders_table.proj_contract_no =" & Me.ProjectContractNum.Column(1)

    Me.proj_status.Requery
    
      
End Sub
______________________________________________________
[end code]

thx.
     Kev
 
sorry missed the attachment
can't find out how to attach it.

message reads as follows
Run-time error '2147352567 (80020009)':
Cannot add record(s);Join key of table Project_Info' not in record set.

My SQL in rowSource looks like this:
SELECT Project_Info.proj_name, Project_Info.proj_contract_no, Project_Info.proj_status, Project_Info.proj_rudd_site_mgr, Project_Info.proj_rudd_site_tel, Project_Info.proj_rudd_site_fax, Project_Info.Proj_del_addr_1, Project_Info.Proj_del_addr_2, Project_Info.Proj_del_addr_town, Project_Info.Proj_del_addr_region, Project_Info.Proj_del_addr_pcode FROM Project_Info;
If I just use the first 2 fields (project number and project name

Thx.
Kev
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top