Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Null value from text box

1 view
Skip to first unread message

NeoFax

unread,
Aug 27, 2010, 8:38:12 AM8/27/10
to
Me.txtMaterial is not grabbing the actual text string from the text
box. When I step thru the code,
Me.txtMaterial is Null. Why is it not grabbing the txtMaterial info?

Private Sub txtMaterial_KeyDown(KeyCode As Integer, Shift As Integer)
fltrInfo = ""
fltrMaterial = Null
fltrMaterial = Me.txtMaterial

If KeyCode = 13 Then
If IsNull(Me.lstPlant) Then
fltrInfo = "(((tblMaterial.Material) Like '" & fltrMaterial &
"'))"
Else
fltrInfo = "(([tblMaterial].[Material] Like '" & fltrMaterial
& "')) AND ([tblMaterial].[Plnt]='" & Me.lstPlant & "')"
End If

DoCmd.OpenForm "frmAllMaterial", acNormal, , fltrInfo
End If
End Sub

Ken Snell

unread,
Aug 30, 2010, 9:38:00 PM8/30/10
to
Using the KeyDown event does not let the texbox update its value before your
code runs, so therefore Me.txtMaterial will not have a value when your code
runs. Why are you using this event to run your code? What is it you're
trying to do?

--

Ken Snell
http://www.accessmvp.com/KDSnell/


"NeoFax" <neof...@gmail.com> wrote in message
news:c0258998-4adc-4584...@t2g2000yqe.googlegroups.com...

NeoFax

unread,
Sep 1, 2010, 3:45:46 PM9/1/10
to
I fixed it to work. Had to add .value to the end. What I am trying
to do is filter a second form based off of a part number the user
type's in the text box and do not want the user to type and then click
a button.
0 new messages