Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't fix this problem in VB

Status
Not open for further replies.

jben2u

IS-IT--Management
Sep 1, 2004
6
CA
this is the error:

run-time Error '2427'
You entered an expression that has no value.

this is the start of the code:

Private Sub Form_Load()
If Me!txtRVID > 0 Then

Explenation:

the form me is a subform and wen you create a new record
my code first loads the form and subform then creates the record in the subform but on load is wen i run this code so the sub form seems to not be accessible to access
 
Try this:

[tt]
If Me!txtRVID.Value > 0 Then
[/tt]

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Perhaps you should check the textbox's value before you do the > 0 check. I would suggest the following:

If Me!txtRVID = "" then
msgbox "Please place a value before you continue", vbokonly
exit sub
end if

If Me!txtRVID = "" does not work, try isnull(Me!txtRVID).

Marrow
 
I often use
"If Len(Nz(textboxname)) = 0 Then etc..."
to test for no data. This appears to get around null values and empty strings at the same time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top