Well, the access application is one mess (not mine ^^). The database is not ACID at all! So I' m improving it a bit, but it's not that easy.
This is probably a form created with the wizard. Every field is linked to a table.field trough record source. So Access creates the record once the form is closed. Since my cboxes are not 'record sourced' they do not function like the rest of the form. (and this creates other problems..) And I can't make them 'record sourced' since this would not display the right information or put the wrong information in the table. I tried with record source, but I'm unable to make it work liek I want it to..
The disadvantage (or advantage for some) are the 'automatic' jobs of Access.
Like: there is a form to add new software (autonumber ID). The field for this ID has a control source. You fill in the fields of the different tabs in the form, close the form and everything is saved in the new record (like an insert into..)
nb: procedure = SOP
TABLE (RN_EQU(strange name for software id...), other stuff, SOP_use (foreign key), SOP_maint (fk), etc..)
The problem I have here is with my comboboxes (for selecting SOP). I can't set a recordsource since I don't want to show an id number in the field. So I use vb (at least, with vb, you know how it works).
On the first tab, selecting the type (here "software"), triggers the creation of a new record in the table, the ID exists, but the record isn't created yet.
So when I choose a SOP with cb that triggers an update, the update doesn't work because the new record is in memory only. So now I'm searching how to arrange this problem... (maybe create a new post for this one.. form_onClose)
The field to fill in (in software table) with cb (insert or update) is an id which is a foreign key to another table. The information displayed in cb is the info from the other table SOP(id, name, and nr (not id)). This is done trough row source type: query and a SELECT query from the SOP table with some WHERE clauses.
It's kind a mess to explain because it is a mess in fact..
Here's the code that works for cb afterupdate and with which (is this English?) I have a msgbox displayed with no text..
-
-
Private Sub cb_swnew_sopu_AfterUpdate()
-
Dim qry_upd_sopu As String
-
On Error GoTo Err_sopu_AfterUpdate
-
-
If IsNull(Me![RN_EQU]) Then Exit Sub
-
DoCmd.SetWarnings False
-
-
Me.txt_swnew_sopu_nr = Me.cb_swnew_sopu.Column(2)
-
-
qry_upd_sopu = "UPDATE [Equipment and Software] SET [Equipment and Software].SOP_use = " & _
-
Me.cb_swnew_sopu.Column(0) & " WHERE [Equipment and Software].RN_EQU = " & _
-
Me.RN_EQU.Value & ";"
-
DoCmd.RunSQL qry_upd_sopu
-
DoCmd.SetWarnings True
-
-
Err_sopu_AfterUpdate:
-
MsgBox Err.Description
-
-
End Sub
So I have no idea what Access is trying to say and why.. (1 record updated, perhaps?)
(I'll take a look at dlookup)