RE: Adding multiple records based on a list box

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Stop!

If one computer can have multiple monitors associated with it then
those two entities shuold be in separate tables in a 1:m relationship.
Access is a relational database, not a spreadsheet. What you're doing
now is basically trying to feed it spreadsheet data.

Once you have your tables correctly designed, you can set up a
main form/sub form where the users can select as many monitors as they
need for any given computer. No code will be necessary.
--
_________

Sean Bailey


"sherriross81" wrote:

Hello,

I have a form that I am testing out a scenario to see if I am apply it to
other forms in my project. The form is called frmTest.

The form is bound to the table TestTable and has columns:
Primary Key , autonumber,
MonitorTknNbr, Number
ComputerTknNbr,Number

The form has a combo box that lists all the ComputerTknNbr and the List box
contains all of the MonitorTknNbrs. The user can select multiple values from
the list box of monitors but only one computer. If the user selects multiple
monitors I want it to insert a separate record in TestTable for each
computer/monitor combination.

I have looked through the discussion boards and found a few examples but I
am having trouble getting them to work so I thought I would post my code here
for some input. I am not sure if this is on the right track or not.....

Private Sub cboSave_Click()
Dim ctl As Control
Dim varItm As Variant

Set ctl = Me.lstMonitors
For Each varItm In ctl.ItemsSelected
DoCmd.GoToRecord acNewRec
Me.txtMonitorID = ctl.ItemData(varItm)
Me.txtComputerID = Me.cboComputerID.Value
Next varItm
Set ctl = Nothing
End Sub

When I run it I get a run time error 2487 The object type argument for the
action or method is blank or invalid.
.



Relevant Pages

  • Re: 2 monitors (separate background pictures)
    ... You can have separate DT's ... and backgrounds on two or more monitors. ... for "windows xp multiple desktops" should get you started. ...
    (microsoft.public.windowsxp.general)
  • Re: I love USB displays!
    ... Actually it should be relatively small pixels with scalable ... work currently some people have 3x 1920x1200 monitors on their ... Plus the laptop LCD display. ... Window manager with multiple virtual desktops. ...
    (comp.arch)
  • RE: Multiple Monitors
    ... multiple monitors, so you might not be able to take advantage of ... Third-party companies, such as Color Graphics, MATROX, STB, INTERGRAPH, ... and other companies provide solutions to multiple ... MATROX Millennium video cards in the same computer support multiple ...
    (microsoft.public.win2000.general)
  • Re: Expose, Spaces and Multiple Displays dont function properly w
    ... Its not just the monitors and spaces its the basics of expose. ... There is also a bug affecting behaviour in multiple monitors. ... Word has crashed serveral times for me... ... John McGhie, Consultant Technical Writer ...
    (microsoft.public.mac.office)
  • Re: RegNotifyChangeKeyValue and multiple keys in Delphi: How ?
    ... > that monitors multiple Registry Keys in Delphi. ... you merely call the thread object's Terminate method, ...
    (alt.comp.lang.borland-delphi)