If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Adding to a Combo Box list
I am trying to add new info to a combo box list.
On a form called frmGenInfo which lists Employees, work sites, and general information about the employee. This is based a table called tblUpdates. It draws from 3 tables, tblEmployee, tblWorkSite, tblGenInfo. I have put a command button on the form so that I can add a new employee. This is on the click command: (I have skipped putting in the error handling lines) Private Sub cmdAddEmployee_Click() Dim NbrEmployeeID As Long If IsNull (EmployeeID) Then EmployeeID = "" Else NbrEmployeeID = EmployeeID EmployeeID = Null End If Do.Cmd.Open Form "frmEmployee", , , , , AcWindowMode.acDialog, "GotoNew" EmployeeID.Requery If NbrEmployeeID 0 Then EmployeeID = NbrEmployeeID End If End Sub The problem is that when it opens the form, it does not go to a new record. It opens and goes to the first record in the table tblEmployee. What am I doing wrong? Thank you for any help. -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
Adding to a Combo Box list
hi,
On 04.04.2010 16:35, Qdxss2b via AccessMonster.com wrote: Do.Cmd.Open Form "frmEmployee", , , , , AcWindowMode.acDialog, "GotoNew" You should copy and past compiled code - in the menu 'Debug\Compile'. 'Do.Cmd.Open' should raise an error. The problem is that when it opens the form, it does not go to a new record. It opens and goes to the first record in the table tblEmployee. What am I doing wrong? You have two possibilities: 1) Use the correct data mode, e.g. DoCmd.OpenForm "frmEmployee", , , , acFormAdd, acDialog or 2) Correct your code in the form open/load event. The usage of the OpenArgs parameter indicates that you wanted to do something like (untested): Private Sub Form_Load() If Not IsMissing(Me.OpenArgs) And Me.OpenArgs = "GotoNew" Then DoCmd.GoToRecord , , acNewRec End If End Sub mfG -- stefan -- |
#3
|
|||
|
|||
Adding to a Combo Box list
DoCmd.OpenForm "frmEmployee", , , , acFormAdd, acDialog I tried adding the acFormAdd and it worked like a charm. Thank you very much. I have been fighting with this for two days and just couldn't figure out what I was missing. Raymond -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|