Combo box in header

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo and several text boxes in my header (Person's Name, Date,
etc.) that I want to be recorded in every record without the user having to
enter it each time in the detail part of the form. I tried two different
methods I found from another post and neither worked.

One was the before insert, set the value in the detail area equal to that in
the header.
Example:
Private Sub Form_BeforeUpdate(Cancel as Integer)
me.txtCoord = me.cboCoordinator
me.txtDate = me.txtCurrentDate
End Sub

The other was to set the default of the text box in the detail section = to
the text box in the header.

Basically, nothing is happening with either method. the text box in the
detail section stays blank, except for in the first record.

Any help would be greatly appreciated! Thank you!
 
I have to ask, if these values are being repeated within a table, has the db
been normalised?
 
Fair question. The database is for capturing data similar to a survey. So, I
followed a design recommended here which has the survey questions in one
table with the responses in another. Because there is the possibility of
responding to some or all of the "survey" questions repeatedly over time, I
am using a modification date in the response table to differentiate the
responses. The other repeated field is the name of the respondent. So, an
example of records in the response table looks something like this:

QuesID ModDate Respondent Response(Drop down list)
1 1/1/05 Doe Yes
2 1/1/05 Doe No

The continuous form will be for all the questions for this date and
respondent, and these are the two fields I want repeated for each question.
Hope this makes sense.
 
So you could almost have the Header being a main form comprising of the
SurveyResults (covering SurveyID,ModDate,Respondent), and instead of a
detail section, have a subform.

In this way, the sub form records (answers to the question for the specific
survey) will automatically be linked to the main form.
 
Probably. Admittedly, I am self-taught Access user, so my knowledge is
somewhat limited, though I've learned a lot here on the newsgroups!

Anyway, I did try using a subform but ran into some problems with that. I
can't remember exactly what kind of problems, but since the header has worked
well in every other way, I decided to go with it. any way of making it work
without trying to do a subform?
 
This sounds about right, but it's not clear why it does not work for you

Private Sub Form_BeforeUpdate(Cancel as Integer)
me.txtCoord = me.cboCoordinator
me.txtDate = me.txtCurrentDate
End Sub

When you run the form, put a break point on the Private Sub bit to check
it's called and then step though. Alternatively
try the same code in the OnCurrent, but check for values first. ie
Private Sub Form_OnCurrent

if isnull(me.txtCoord) then me.txtCoord = me.cboCoordinator
'And so on.
End Sub
 
I found how to put a break point in, and if I understand correctly, it looks
like the sub routine is not running at all (if it was, the VB code box would
open up to that line of code, right?).

So, any ideas why the code isn't running at all?
 
Back
Top