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

Form Loading

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm trying to use the following code so that when my form loads in my project the text boxes are updated with information from my database. As far as I can tell, this code is the same as for 3 other forms in my project, which all load perfectly fine, but whatever code I use for this form I get an error. What's wrong?

Option Explicit

Private Sub cmdClose_Click()
Form5.Hide 'when the close button is clicked, hide the form
Unload Form5

Form1.Show 'show form 1
End Sub

Private Sub updateFields()
txtEntitlement.Text = DataEnvironment1.rsHolidaySick.Fields("Entitlement")
txtTaken.Text = DataEnvironment1.rsHolidaySick.Fields("Taken")
txtRemaining.Text = DataEnvironment1.rsHolidaySick.Fields("Remaining")
txtSickEntitlement.Text = DataEnvironment1.rsHolidaySick.Fields("Sick Entitlement")
txtSickTaken.Text = DataEnvironment1.rsHolidaySick.Fields("Sick Taken")
txtSickRemaining.Text = DataEnvironment1.rsHolidaySick.Fields("Sick Remaining")
'update the text boxes with data from the relevant database fields
End Sub

Private Sub Form_Load()
updateFields 'initiate the update fields command when the form loads
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top