Page 1 of 1 1
Topic Options
#85162 - 2002-02-21 08:56 PM Access to Access
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I can sucessfully connect to an Access DB and update a record (hooray!!), but I have another problem.

a few fields in the record are lookups to other tables. In this case, I have one field which is processor_speed. I cannot poke 400 into it by updating the record. If I open Access and view the form, I can select 400 from the drop down list.

this is the lookup info:
Row Source: SELECT Processor.Processor FROM Processor;
(which is a list procesor speeds)

but the table I have my inventory is [PC Inventory Main TBL] (and where I'm doing record updating)

the recordset command from my script is(doesn't work): $Recordset.Fields("ProcessorType").Value = "$CPUsp"

The other fields which are just text update fine.

Any help is appreciated...

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#85163 - 2002-02-21 08:59 PM Re: Access to Access
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
BTW, here is my record update code:

code:

if $Connection ;Check for connection object
$Connection.ConnectionString = $DSN
$Connection.Open() ;Open connection to database
$Command.ActiveConnection = $Connection
$Recordset.CursorType = 3
$Recordset.LockType = 3
$Recordset.ActiveCommand = $Command
$Command.CommandText = $CHECK_SerialNumber ;Check for existing records for the current workstation/user
$Recordset.Open($Command)
If $Recordset.RecordCount < 1 $Recordset.AddNew Endif
$Recordset.Fields("LastName").Value = "$lastname"
$Recordset.Fields("FirstName").Value = "$firstname"
$Recordset.Fields("NTLogon").Value = "@USERID"
$Recordset.Fields("ComputerName").Value = "@WKSTA"
$Recordset.Fields("Division").Value = "$dept"
$Recordset.Fields("BureauName").Value = "BureauName"
$Recordset.Fields("Building").Value = "Area Office 6"
$Recordset.Fields("RoomNumber").Value = " "
$Recordset.Fields("Location").Value = "6 Tampa"
$Recordset.Fields("AHCATag").Value = " "
$Recordset.Fields("SerialNumber").Value = "$SerNo"
$Recordset.Fields("Manufacturer").Value = "$Make"
$Recordset.Fields("ModelName").Value = "$Model"
$Recordset.Fields("ProcessorType").Value = "$CPUsp"
$Recordset.Fields("Memory").Value = "$Memory"
$Recordset.Fields("Harddrive").Value = " "
$Recordset.Fields("Bios").Value = "$biosv"
$Recordset.Fields("Surplus").Value = 0
$Recordset.Fields("Comments").Value = " "
$Recordset.Update
$Recordset.Close()

$Connection.Close()
$Connection = 0
$Recordset = 0
$Command = 0


but the $Recordset.Fields("ProcessorType").Value = "$CPUsp" line doesn't work.

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#85164 - 2002-02-22 04:16 PM Re: Access to Access
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If the field ProcessorType is defined as an integer in your table you might want to use $Recordset.Fields("ProcessorType").Value = Val($CPUsp) to make sure that an integer value is inserted instead of a string value. It's just a wild guess but give it a try.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.054 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org