Help..Table to form VBA Trouble

A

Adam

I am sort of a rookie when it comes to writing code. (So please simple English)

I am working on a form using checkboxes which will assign an amount into a
separate field.
Example:

Private Sub Ctl1_2weekIntro_AfterUpdate()
If Me![1-2weekIntro] = True Then
Me![1-2weekIntro$] = "$35.00"
Else
Me![1-2weekIntro$] = Null
End If

End Sub

What I would like it to do is have the code draw "$35.00" from another table
called [PayTable]. Referencing the [PayID] (1) and then placing the
value=($35.00) which is being drawn from the field called [Amount].



Thanks....

Adam
 
O

Ofer Cohen

Try using Dlookup

Private Sub Ctl1_2weekIntro_AfterUpdate()
If Me![1-2weekIntro] = True Then
Me![1-2weekIntro$] = DlookUp("Amount","PayTable","PayID = 1")
Else
Me![1-2weekIntro$] = Null
End If

End Sub

If the PayID field is text, then try
Me![1-2weekIntro$] = DlookUp("Amount","PayTable","PayID = '1'")
 
A

Adam

Thanks... it works great

Ofer Cohen said:
Try using Dlookup

Private Sub Ctl1_2weekIntro_AfterUpdate()
If Me![1-2weekIntro] = True Then
Me![1-2weekIntro$] = DlookUp("Amount","PayTable","PayID = 1")
Else
Me![1-2weekIntro$] = Null
End If

End Sub

If the PayID field is text, then try
Me![1-2weekIntro$] = DlookUp("Amount","PayTable","PayID = '1'")

--
Good Luck
BS"D


Adam said:
I am sort of a rookie when it comes to writing code. (So please simple English)

I am working on a form using checkboxes which will assign an amount into a
separate field.
Example:

Private Sub Ctl1_2weekIntro_AfterUpdate()
If Me![1-2weekIntro] = True Then
Me![1-2weekIntro$] = "$35.00"
Else
Me![1-2weekIntro$] = Null
End If

End Sub

What I would like it to do is have the code draw "$35.00" from another table
called [PayTable]. Referencing the [PayID] (1) and then placing the
value=($35.00) which is being drawn from the field called [Amount].



Thanks....

Adam
 
Top