simple question: to update the record in a table that is not the current datasource...

M

Mark Kubicki

I suspect, I'm in the right church, but the wrong pew...

I want to update a table, which is not the record source for the current
form, when the value of a combobox [cboPresetOption] on the current form is
changed.
the table [tbeFixtureSchedulePrintOptions] which contains the fields to be
updated has only (1) record
I've got the code below written, but the record is not updatin; and I
suspect I have a simple error, but am blind to it at this particular
moment...

thanks in advance,
-mark

---------------------------------------------
Private Sub cboPresetOption_Change()

Set Db = CurrentDb()
Dim rst As DAO.Recordset
Set rst = Db.OpenRecordset("SELECT * FROM
[tbeFixtureSchedulePrintOptions]")
With rst
.Edit

Select Case .cboPresetOption
Case Is = "First Draft"
'fixture identifier options
.ManufacturersName = 1
.InclCatalogNo = "no"
.InclAltMfrs = "no"

'description options
.ShortDescription.Value = "no"
.InclLocations = "yes"
.SeeSketch = "no"
.InclInstallationNotes = "no"
.InclLeadTime = "no"
...

Case Is = "Working Copy"
'fixture identifier options
.ManufacturersName = 2
.InclCatalogNo = "yes"
.InclAltMfrs = "yes"
.ShortDescription.Value = "yes"
...

Case Is = "Preliminary" '
...

End Select

.Update
End With
Me.cmdFixtureSchedulePrint.SetFocus

Set dbs = Nothing
Set rst = Nothing

End Sub
 
M

Marshall Barton

Mark said:
I want to update a table, which is not the record source for the current
form, when the value of a combobox [cboPresetOption] on the current form is
changed.
the table [tbeFixtureSchedulePrintOptions] which contains the fields to be
updated has only (1) record
I've got the code below written, but the record is not updatin; and I
suspect I have a simple error, but am blind to it at this particular
moment...
---------------------------------------------
Private Sub cboPresetOption_Change()

Set Db = CurrentDb()
Dim rst As DAO.Recordset
Set rst = Db.OpenRecordset("SELECT * FROM
[tbeFixtureSchedulePrintOptions]")
With rst
.Edit

Select Case .cboPresetOption
Case Is = "First Draft"
'fixture identifier options
.ManufacturersName = 1
.InclCatalogNo = "no"
.InclAltMfrs = "no"

'description options
.ShortDescription.Value = "no"
.InclLocations = "yes"
.SeeSketch = "no"
.InclInstallationNotes = "no"
.InclLeadTime = "no"
...

Case Is = "Working Copy"
'fixture identifier options
.ManufacturersName = 2
.InclCatalogNo = "yes"
.InclAltMfrs = "yes"
.ShortDescription.Value = "yes"
...

Case Is = "Preliminary" '
...

End Select

.Update
End With
Me.cmdFixtureSchedulePrint.SetFocus

Set dbs = Nothing
Set rst = Nothing

End Sub

I'm surpised if you did not get an error with that code. It
looks ok, except that recordset fields referenced using !
instead of .
!ManufacturersName = ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top