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!

write to bound field on continuous form

Status
Not open for further replies.

northernbeaver

Programmer
Jul 9, 2001
164
0
0
CA
I have a continuous form that is bound to the table. three fields in question at the moment:

cboCategoryID - a combo box bound to field catID

txtEmployeeID - a text box bound to field EmpID and is hidden

txtStartDate - a text box bound to field startdate the textbox is set to have the format of short date and is hidden as well

there are two objects in the header of the form that are not bound to any fields in the table where the user is to enter the start date and select from a combo box which employee.

now that you have history and a picture of what Im doing here is the problem Im having. under the On lost focus event of cboCategoryID I have the following simple code that doesnt seem to work
Code:
If Me.txtEmployeeID = "" Or insull(Me.txtEmployeeID) Then
    Me.txtEmployeeID = Me.cboDefEmp
End If
If Me.txtStartingDate = "" Or IsNull(Me.txtStartingDate) Then
    Me.txtStartingDate = Me.txtDefault
End If
If Me.categoryid = "" Or IsNull(Me.categoryid) Then
    MsgBox "Please select category before entering hours"
    Me.categoryid.SetFocus
End If

now when the code runs and you trigger the lost focus code it selects the first .txtemployeeid and gives a compile error: sub or function not defined. I have verified that there are no spelling mistakes. anyone know why I cant reference fields on a continuous form?
 
The code you posted is inconsistent with the control names:
txtStartingDate vs txtStartDate
categoryid vs cboCategoryID

Seems you have renamed some fields and the event procedures should perhaps be recreated.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
thanks for the responce but I have verified that the names in the code is correct. any other ideas?
 
compile error: sub or function not defined
Any chance you could post the highlighted code when in debug mode ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
as I must admit I dont know how to include screen captures on tek-tips here I will attempt to describe the window.

again here is the code
Code:
If Me.txtEmployeeID = "" Or insull(Me.txtEmployeeID) Then
    Me.txtEmployeeID = Me.cboDefEmp
End If
If Me.txtStartingDate = "" Or IsNull(Me.txtStartingDate) Then
    Me.txtStartingDate = Me.txtDefault
End If
If Me.categoryid = "" Or IsNull(Me.categoryid) Then
    MsgBox "Please select category before entering hours"
    Me.categoryid.SetFocus
End If

when in debug the part of the code that is selected is the first txtEmployeeID but not the me. I have commented out code to see if it is just the certain object it doesnt like but when I comment out the first IF statement it hits the same error and then selects the first txtStartingDate. so it selects the name of the object in reference on the continous form. I appreaciate any help you can give and have already given
 
A hint may be found in code elements which are not capitalized when moving to the next line, try changing "insull" to "isnull";-)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top