L
Ladymuck
I have a database that has two tables: (well, more but they're irrelevant
right now! tblRecord and tblSoftware.
In tblRecord, there is a field fldSoftware that is linked to tblSoftware. I
have set it so that it is a combo box displaying three fields from
tblSoftware (fldManufacturer, fldProduct, fldVersion). When you select a
particular item (eg Adobe, Acrobat, 5.0) only fldManufaturer is displayed in
fldSoftware. This is fine, I'm happy with that.
I have outputted tblRecord to a form, nothing fancy, used the Wizard, no
additional tables or queries used.
What I would like to be able to do, using the link described above is to
populate another field on tblRecord called fldComment with the other two
fields (fldProduct and fldVersion). Lots of things I've seen on various
forums say to use SQL and an UPDATE query. I have reservations about doing
this as this will update the whole table and not just the current record but
I did it anyway and it bleats like a good 'un about another user updating the
record, do I want to save the changes, etc but it does finally do what I want
it to do. Here is the code:
Public Sub fldSoftware_AfterUpdate()
Dim strSQL As String
strSQL = "UPDATE tblSoftware INNER JOIN tblRecord " & _
"ON tblSoftware.fldSoftwareID = tblRecord.fldSoftware SET
tblRecord.fldComment = 'Software Installed: ' & tblSoftware.fldProduct & ' '
& tblSoftware.fldVersion " & _
"WHERE ((([tblRecord].[fldSoftware])=[tblSoftware].[fldSoftwareID])
AND ((tblRecord.fldSoftware) Is Not Null));"
DoCmd.RunSQL strSQL
End Sub
I've set it to the AfterUpdate event on the fldSoftware control. The not
null bit at the end is because it is not compulsory to select something from
fldSoftware and I don't want it to fall over if it is empty.
Is what I am trying to do possible? Or am I barking up the wrong tree?
BTW, I am using Access 2003 in 2000 mode.
Huge thanks for any hints or tips provided!
right now! tblRecord and tblSoftware.
In tblRecord, there is a field fldSoftware that is linked to tblSoftware. I
have set it so that it is a combo box displaying three fields from
tblSoftware (fldManufacturer, fldProduct, fldVersion). When you select a
particular item (eg Adobe, Acrobat, 5.0) only fldManufaturer is displayed in
fldSoftware. This is fine, I'm happy with that.
I have outputted tblRecord to a form, nothing fancy, used the Wizard, no
additional tables or queries used.
What I would like to be able to do, using the link described above is to
populate another field on tblRecord called fldComment with the other two
fields (fldProduct and fldVersion). Lots of things I've seen on various
forums say to use SQL and an UPDATE query. I have reservations about doing
this as this will update the whole table and not just the current record but
I did it anyway and it bleats like a good 'un about another user updating the
record, do I want to save the changes, etc but it does finally do what I want
it to do. Here is the code:
Public Sub fldSoftware_AfterUpdate()
Dim strSQL As String
strSQL = "UPDATE tblSoftware INNER JOIN tblRecord " & _
"ON tblSoftware.fldSoftwareID = tblRecord.fldSoftware SET
tblRecord.fldComment = 'Software Installed: ' & tblSoftware.fldProduct & ' '
& tblSoftware.fldVersion " & _
"WHERE ((([tblRecord].[fldSoftware])=[tblSoftware].[fldSoftwareID])
AND ((tblRecord.fldSoftware) Is Not Null));"
DoCmd.RunSQL strSQL
End Sub
I've set it to the AfterUpdate event on the fldSoftware control. The not
null bit at the end is because it is not compulsory to select something from
fldSoftware and I don't want it to fall over if it is empty.
Is what I am trying to do possible? Or am I barking up the wrong tree?
BTW, I am using Access 2003 in 2000 mode.
Huge thanks for any hints or tips provided!