Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop down box problem 1

Status
Not open for further replies.

jeph

Programmer
Jun 21, 2000
10
DE
hi,
im having some trouble with using drop down boxes in a form with data sheet view.
field1 is a drop down box i can choose a value from. after that im doing a requery on field2 which is another drop down box with values depending on the choice i made in field1.
it works so far with one record.
unfortunately, when i select a value in field1 in another record in this data sheet, the requery is done on all field2, and they all use the value from the active record as criteria, not from "their" field1.
anybody knows how to handle this problem?

thanks,
jeph
 
Try to change the RowSource of field2 on the OnEnter event
like this:

Private Sub VareNR_Enter()
Dim Firma
Firma = FindFirma
If not IsNull(Me!Field1) Then
Me!Field1.RowSource = "SELECT * FROM YrTbl WHERE YrID=" & Me!field1
Else
Me!Field1.RowSource = "SELECT * FROM YrTbl"
End If
Let the rest of the fields be dependent on the field2.
I use something like this on a form and it works fine.
Rgds
Herman
 
nice, that was exactly what I needed.
the requery was still giving me some trouble because it kept "kicking" values from the field2 in other records, but with your piece of code I could remove it.

thanks,
jeph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top