Any help will appreciated.
Table tblAll
Country
City
Cost
Cost2
Inside Form have pull down.
cboCountry
cboCity
Then automate Cost into field
txtItemDesc
and Cost2
txtItemDesc
Code:
Private Sub cboCity_AfterUpdate()
Me.txtItemDesc = DLookup("[Cost]", "tblAll", "[City] ='" & _
[Forms]![frmlAdditions]![cboCity] & "'")
Me.txtItemDesc2 = DLookup("[Cost2]", "tblAll", "[City] ='" & _
[Forms]![frmlAdditions]![cboCity] & "'")
End Sub
Private Sub cboCountry_AfterUpdate()
On Error Resume Next
cboCity.RowSource = "Select tblAll.City " & _
"FROM tblAll " & _
"WHERE tblAll.Country = '" & cboCountry.Value & "' " & _
"ORDER BY tblAll.City;"
End Sub
Problem is that in my tblAll I have repeating items in Country and City with in the fields therefore with cboCity code. It only will produce the cost for the first time in the City field.
What I need is for this on cboCity after update if Country and City than cost.
Hope I have list enought to make sense.
Table tblAll
Country
City
Cost
Cost2
Inside Form have pull down.
cboCountry
cboCity
Then automate Cost into field
txtItemDesc
and Cost2
txtItemDesc
Code:
Private Sub cboCity_AfterUpdate()
Me.txtItemDesc = DLookup("[Cost]", "tblAll", "[City] ='" & _
[Forms]![frmlAdditions]![cboCity] & "'")
Me.txtItemDesc2 = DLookup("[Cost2]", "tblAll", "[City] ='" & _
[Forms]![frmlAdditions]![cboCity] & "'")
End Sub
Private Sub cboCountry_AfterUpdate()
On Error Resume Next
cboCity.RowSource = "Select tblAll.City " & _
"FROM tblAll " & _
"WHERE tblAll.Country = '" & cboCountry.Value & "' " & _
"ORDER BY tblAll.City;"
End Sub
Problem is that in my tblAll I have repeating items in Country and City with in the fields therefore with cboCity code. It only will produce the cost for the first time in the City field.
What I need is for this on cboCity after update if Country and City than cost.
Hope I have list enought to make sense.