Results 1 to 2 of 2
2009-10-17, 14:11 #1
- Join Date
- Feb 2003
- St Louis, Missouri, USA
- Thanked 1 Time in 1 Post
I have a form that was formerly using bound fields but the client wanted a SAVE button. I converted to unbound fields and the save works.
When they come back to the field and choose an Employee, I want to go to the table and populate the form. Somehow, I have goofed the syntax. HELP!
Private Sub Combo54_AfterUpdate() ' Find the record that matches the control. Dim rs As Object Dim myTable As DAO.Recordset Set rs = Me.Recordset.Clone rs.FindFirst "[EmployeeID] = '" & Me![Combo54] & "'" ' If Not rs.EOF Then Me.Bookmark = rs.Bookmark '======================= Set myTable = CurrentDb.OpenRecordset("tbl_Employees", dbOpenDynaset, dbSeeChanges) myTable.FindFirst "[EmployeeID] = '" & Me.Combo54.Value & "'" If myTable.NoMatch Then MsgBox "No Found" Else ' Set the recordSet With myTable .Edit Me.EmployeeID = [EmployeeID] ' Table items ------------- Blows up here Me.FName = [FName] Me.LName = [LName] Me.DeptLocation = [DeptLocation] Me.JobTitle.Value = [JobTitle] Me.MainAddress = UCase([MainAddress]) Me.MainCity = UCase([MainCity]) Me.MainState = UCase([MainState]) Me.MainZip = [MainZip]Alan
2009-10-17, 15:28 #2
- Join Date
- Aug 2001
- Evergreen, CO, USA
- Thanked 60 Times in 60 Posts
[quote name='MacroAlan' post='798574' date='17-Oct-2009 12:11']I have a form that was formerly using bound fields but the client wanted a SAVE button. I converted to unbound fields and the save works.
My initial reaction in this situation would be to put a button they could click to save the record that didn't do anything - well maybe it would run a DoCmd.RunCommand.acSaveRecord....
In any event, I believe your line of code that blows up should be either:
Me.EmployeeID = .[EmployeeID]
Me.EmployeeID = myTable.[EmployeeID]Wendell