IIf Statement to look for value in a table field

L

Les

Good day,

I am wanting to look up up a value in a table (KTL) field [Project] and
then do the following:-

if [Project]= 90ZA0510 then
PU 09/05
Elseif
End If

Then i need to put the result "PU 09/05" into a TextBox in a form.

I do not know if this is possible, or should one do an update querry
and change the project name that way ?
 
S

Sharkbyte

Les:

I'm not quite sure what "PU" is, but your code appears to be correct. Use
the AfterUpdate event, on the control you are using to select the Project.

As for saving/updating the record, only you can decide if that is what you
need to do.

I do want to point out that this code would only provide data back when it
is dealing with Project "90ZA0510", and nothing else. If you are trying to
generate data, based on information contained within the Project identifier,
then your code would need to be a little different.

Sharkbyte
 
L

Les

Hi Sharkbyte, firstly thanks for the help. I need to change the "key
word" 90ZA0510" to the generic project name that all users know which
is "PU 09/05" i tried the code below, but cant get it to work. It runs
until the last "frmPUR_Overview.txtProject = myValue" statement and
tells me object required, can you help me ?
It is possible that the project might have another key word, but then i
will use else if for that to select the correct one. I just need to
display the new project name on the form so the reader knows which
project we are dealing with. ( will only reply tomorrow as i am on my
way home. SA - 16:15)

Private Sub txtProject_AfterUpdate()
Dim myProj As Variant
If txtProject = "90ZA0510" Then
myValue = "PU 09/05"
Else
End If
frmPUR_Overview.txtProject = myValue ' txtProject is the name of the
Text Box

End Sub
 
Top