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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code branching not accurate

Status
Not open for further replies.

Amadea

Technical User
Oct 11, 2003
49
0
0
US
Hi all,
The code snippet below is the last section of an If..Then. The code preceeding checks to be certain combo boxes have a selection. Once that is satisfied, I want the record selected in the list box to be evaluated as to whether the 12th column of information is empty or not. If the column data is not blank (the column contains text) then display a message box that says data exists and click OK to open a change form. If the column is empty/blank/no text exists, then open an add form. I'm trying to code for spaces that may be present and would be considered blanks.

Thanks in advance for your assistance.

Here is the code I've got so far.

ElseIf Me!lstSelectSection.Column(12) <> " " Or Not IsEmpty(Me!lstSelectSection.Column(12)) Then
If MsgBox("This section has Special Narrative." _
& Chr(13) & Chr(10) _
& "Press 'OK' to open the Change Narrative screen.", _
vbOKOnly, "Special Narrative Redirect.") = _
vbOK Then

Dim strDocName As String
Dim strLinkCriteria As String
strDocName = "frmChngSpeNarr"
strLinkCriteria = "[Sect]=" & "'" & Me![Sect] & "'"

DoCmd.OpenForm strDocName, , , strLinkCriteria
End If
Else
strDocName = "frmAddSpeNarr"
strLinkCriteria = "[Sect]=" & "'" & Me![Sect] & "'"

DoCmd.OpenForm strDocName, , , strLinkCriteria
End If
 
ElseIf Trim(Me!lstSelectSection.Column(11) & "") <> "" Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Great, thank you. I'd forgotten about Trim...a valuable tool.

I've since changed the line
Me!lstSelectSection.Column(12)
referring to a column in a list box, to
Me!txtSpeNarr
referring to a hidden text box that "displays" the field data I am evaluating.
Is there some reason why using the list box reference wouldn't work, except for maybe pointing to the wrong column?
Thanks.
Nathalie
 
Reread my post.
The 12th column is Column(11)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You are an angel! I did see the eleven, just foolishly thought it might be a typo. Now I know better.
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top