Hi Guys,
I am just moving into the realm of vba and could do with some help!
What I am trying to achieve is this:
I have a form called onenumberformtest, this form displays a table called "Rates Table". The field [Client Name] is a combo box and feeds from a table called "client standard financials". The "client standard financials" table contains generic data for my clients. What I would really like to do is have an afterupdate event or onexit event that looks at [Client Name] on the form and updates generic fields in "Rates Table" with data from "Client standard financials". I have been trawling through previous posts looking for clues...here is what I have tried...and failed. I understand what it is doing with its Dlookup....I just think I am being let down on my lack of vba knowledge...so if anyone can spare the time to put me on the right path I would be very grateful
Here is what I tried...probably totally wrong
Private Sub combo_client_name_Exit(Cancel As Integer)
Dim varRate, As Variant
varRate = DLookup("Rate", "Client standard financials table", "Client Name ='" & Forms!Onenumberformtest!Name & "'")
If (Not IsNull(varRate)) Then [Rates Table]![Rate] = varRate
End Sub
I am just moving into the realm of vba and could do with some help!
What I am trying to achieve is this:
I have a form called onenumberformtest, this form displays a table called "Rates Table". The field [Client Name] is a combo box and feeds from a table called "client standard financials". The "client standard financials" table contains generic data for my clients. What I would really like to do is have an afterupdate event or onexit event that looks at [Client Name] on the form and updates generic fields in "Rates Table" with data from "Client standard financials". I have been trawling through previous posts looking for clues...here is what I have tried...and failed. I understand what it is doing with its Dlookup....I just think I am being let down on my lack of vba knowledge...so if anyone can spare the time to put me on the right path I would be very grateful
Here is what I tried...probably totally wrong
Private Sub combo_client_name_Exit(Cancel As Integer)
Dim varRate, As Variant
varRate = DLookup("Rate", "Client standard financials table", "Client Name ='" & Forms!Onenumberformtest!Name & "'")
If (Not IsNull(varRate)) Then [Rates Table]![Rate] = varRate
End Sub