first ever post - not sure if this should be in programming or forms
Hope I've supplied enough info and it is clear enough
I have created a small database part of which is a jobs to do list. There is a precis form of this list (dgF_ToDo) and a more detailed form (dgF_Events). A user can double-click on one of the jobs in the precis list to display the more detailed list.
The only events associated with both forms are the double-click event on the precis list and the open event on the detailed list. There are no 'public' variables.
*The VBA code for the double-click event on dgEventData on form dgF_ToDo is : (I've numbered the lines for reference)
1 If Not IsNull(Me![dgCategory_tb]) Then dgcat = Me![dgCategory_tb] Else dgcat = "no cat"
2 If Not IsNull(Me![dgSubCategory_tb]) Then dgsubcat = Me![dgSubCategory_tb] Else dgsubcat = "no subcat"
3 If Not IsNull(Me![dgItemName_tb]) Then dgitem = Me![dgItemName_tb] Else dgitem = "no item"
4 If Not IsNull(Me![dgEventRef_tb]) Then dgEventRef = Me![dgEventRef_tb] Else dgEventRef = "no event ref"
5 dgWhere = "[dgEventRef] = " & dgEventRef
6 dgwstring = dgcat + "*" + dgsubcat + "*" + dgitem + "*"
7 dgopenargs = dgwstring
8 DoCmd.OpenForm "dgF_Events", , , dgWhere, , , dgopenargs
dgF_Events OPEN event deconstructs the argument string (dgCategory, dgSubCategory, dgItemName), opens the form and populates unbound fields in the form header (dgCategory_tb, dgSubCategory_tb, dgItemName_tb) and dgEventData_tb in the form 'detail' section.
It all works OK BUT…
Where does it get this data from in line 1 ??? --- it's in the underlying query but there is no [dgCategory_tb] on the form. (ditto line 2 as well).
Me![dgCategory_tb] just doesn't exist !
Yet it works just fine.
Stepping through the code execution picks up the category successfully. How ??
dgF_Events then populates Category & SubCategory from the supplied arguments without a problem.
If I comment out line 1 then dgF_Events displays OK but with "no Catgeory specified" in that field.
If I try to set the focus on dgCategory on form dgF_ToDo (in an desparate attempt to find it on the form) it says 'can't do it' ! - Of course it can't - it's not there. Until I set dgcat to it - then suddenly it's there !?!?
TILT !!
I must be missing something fundamental here and am now so locked into this I can't seem to get out of this thought track. I'm stuck.
Can anyone help ? I hope I have provided enough information.
Here are the relevent parts of my Db : (or at least the relevent bits of them)
dgT_ToDo
- a table with fields (amongst others) :
- dgdate
- dgRefNum (autonum)
- dgCategory
- dgSubCategory
- dgItemName
- dgEventData
- dgCreationDate
dgQ_ToDo
- query just orders all the data in table 'dgT_ToDo' appropriately.
dgF_ToDo
- continuous form based on a single query dgQ_ToDo with job (event) precis information - fields are :
- dgdate_tb - populated by Date()
- dgRefNum_tb (autonum)
- dgItemName_tb
- dgCreationDate_tb
- dgEventData_tb
dgF_Events
- single form with more detailed event informaton includes the following fields (amongst others) :
- dgCategory_tb
- dgSubCategory_tb
- dgItemName_tb
- dgEventData_tb.