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

Loop Cast problem

Status
Not open for further replies.

swk003

IS-IT--Management
Feb 10, 2004
86
GB
I am trying to right a loop that tests whether a text box integer value and a command button event click are false before executing the body of the loop. Problem is that I can't get my head round the cast issue. See below code any assistance would be appreciated:


Private Sub Photoset_PID_Exit(Cancel As Integer)

Do Until (Me.txt_RGC_box_position > 9) Or (cmd_CloseLoggingBox.OnClick())

DoCmd.GoToRecord , , acNewRec
'reset controls to null values
Me!Photoset_PID = ""
Me!txt_InfiniteCounter = ""
Loop
MsgBox "Time to do some Validation"

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_Validation"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.GoToRecord , , acNewRec
'reset controls to null values
Me!Photoset_PID = ""
Me!txt_InfiniteCounter = ""
End Sub
 
Cast issue?

I could be wrong but isn't OnClick() a procedure that has no return type? What I suggest instead is in your OnClick command button to include cmd_CloseLoggingBox.Enabled = False. Then instead of using Or (cmd_CloseLoggingBox.OnClick()) replace it with Or Not cmd_CloseLoggingBox.Enabled.

Also, I don't see why you're using a loop. It looks like you're only working with one record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top