Cascade Help neeeded

eholtman

Registered User.
Local time
Today, 13:47
Joined
Oct 12, 2004
Messages
54
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.
 
There are 2 thinks I have tried but must not be writing correctly

Current Code

Code:

Private Sub cboCity_AfterUpdate()
Me.txtItemDesc = DLookup("[Cost]", "tblAll", "[City]&[Country] ='" & _
[Forms]![frmlAdditions]![cboCity] & "'")
Me.txtItemDesc2 = DLookup("[Cost2]", "tblAll", "[City]&[Country] ='" & _
[Forms]![frmlAdditions]![cboCity] & "'")

End Sub

or

Private Sub cboCity_AfterUpdate()
On Error Resume Next
txtItemDesc.RowSource = "Select tblAll.Cost " & _
"FROM tblAll " & _
"WHERE tblAll.Country = '" & tblAll.City = "'" & cboCountry.Value & "' " & _
"ORDER BY tblAll.Cost;"
End Sub

Neither are working. I need this done by tonight for a project. So any help please. Last thing.

Thanks
 
Dont mean to be updating but i made a quick example.

Any help appreciated.
 

Attachments

E,

Maybe?


Code:
Private Sub cboCity_AfterUpdate()
   Me.txtItemDesc = DLookup("[Cost]", _
                            "tblAll", _
                            "[Country] = '" & Me.cboCountry & "' And " & _
                            "[City] = '" & Me.cboCity & "'")
   Me.txtItemDesc2 = DLookup("[Cost2]", _
                             "tblAll", _
                             "[Country] = '" & Me.cboCountry & "' And " & _
                             "[City] = '" & Me.cboCity & "'")
End Sub

Wayne
 
Dude you rock... Somethingk simple I get to go to bed.... Yes

thanks alot
 

Users who are viewing this thread

Back
Top Bottom