Access Table Combo Box

Results 1 to 2 of 2

Thread: Access Table Combo Box

  1. #1
    Lovro Guest

    Default Access Table Combo Box

    First hello.<BR><BR>I have two tables, which look like this:<BR><BR>Person:Table<BR><BR>NAME LASTNAME JOBID<BR>John Doe 5<BR>Kay Pantilovich 2<BR>Dick Smitch 2<BR><BR>Job:Table<BR><BR>JOBID JOBTITLE<BR> 5 robber<BR> 2 barber<BR><BR>They are related by JOBID Field. In Job table JOBID is primary key and therefore unique.<BR><BR>What I would like is to have a Combo Box in the PERSON table that would drop down all JOBTITLES with values of it&#039s JOBID. When clicked the same JOBID from Table:Jobs would be transferred to PERSON table, which would then be long integer and not text, so that they could be joined by JOBID.<BR><BR>I hope I made sense. You guys and girls are smart enough to figure it out. Thanks in advance. :)<BR><BR> The neewbie in Databases<BR> Lovro from Slovenia<BR><BR>

  2. #2
    Eddie Campbell Guest

    Default RE: Access Table Combo Box

    There are a couple of steps you need to go through.<BR><BR>1) Display a person record on the form and show a combo box based on the job titles. I assume that you are OK with displaying the person.<BR><BR>To display the jobtitles, create a recordset and build the combo box.<BR><BR>&#060;% response.write "&#060;Select name=&#039JobTitles&#039&#062;"<BR> do while not JobtitleRs.Eof<BR>&#039<BR>&#039&#039&#039 If the person already has a job default the combo box to that one<BR>&#039<BR> If PersonRs("JobId") = JobTitleRs("JobId") Then<BR> SelStatus = " Selected"<BR> Else<BR> SelStatus = ""<BR> End If<BR> Response.write "&#060;Option" & SelStatus & " value=&#039" & JobTitleRs("JobId") & "&#039&#062;" & JobTitleRs("JobTitle") & "&#060;/Option&#062;"<BR> JobTitleRs.MoveNext<BR> Loop<BR> Response.Write "&#060;Select&#062;" %&#062;<BR><BR>2) You will need to submit the changes made to the form so that they can be processed at the server side. To get the value of the combo box, call Request.Form("JobTitles") this will return the JobId which you can then use to update your PersonRs with.<BR><BR>Hope this helped<BR>Eddie - Hello to Slovenia !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts