recieving no data, will not refresh

G

GTP

Can someone help me with a refresh on my 3rd dropdown?
When I go through all three drop downs and then want to go
back through the dropdowns once again, only the first two
will refresh and the third has no information.

Three fields in one table, custID, Division, Jobsite
three dropdowns - cboCust, cboDivision, cboJobsite

CODE:
Option Compare Database

Private Sub cboCust_AfterUpdate()

Dim strSearch As String


'For text IDs
strSearch = "[CustID] = " & Chr$(34) & Me![cboCust] &
Chr$(34)

'Find the record that matches the control.
Me.RecordsetClone.FindFirst strSearch
Me.Bookmark = Me.RecordsetClone.Bookmark

'requery the Division combox box so that it shows correct
information (given in the row source)
Me![cboDivision].Requery
Me.cboDivision.Enabled = True
Me![cboDivision].Value = "Select Division"

Me![cboJobsite].Requery
Me.cboJobsite.Enabled = True
Me![cboJobsite].Value = "Select Jobsite"


End Sub

Private Sub Form_Load()
Me.cboCust.Value = "select a customer"
Me.cboDivision.Enabled = False
Me.cboJobsite.Enabled = False


End Sub

Thank you,
Greg
 
R

ReferenceMan

I don't quite understand what you try to accomplish here,
Greg,

How many keys does the table have?
What is the role of the drop down fields in the form?
Where the information is coming from to your dropdown
fields..what is the RecordSource for them?

But, assuming that the table has only one key on
CustomerID field and you are trying to filter the records
by the value on CustomerID drop down field in the form,
here is the simple code that will make the trick.
(if you want a user to filter the records using all three
drop down fields you need to use different code)

Put a new dropdown field called cmbChosenCustomer on the
form.
Hide the CustomerID field that is connected to the table.
On Change Event of the cmbChosenCustomer field put this
code:

Private Sub cmbChosenCustomer_Change()
Me.Filter = "CustomerID = " & [cmbChosenCustomer]
Me.FilterOn = True
End Sub

next time when a user chooses Customer ID, your other
drop down fields will reflect relevent to Customer ID
info.

Was it helpful..or I just didn't get what you were asking?
 
G

GTP

I actually have 3 keys. CustID, Division, and Jobsite, in
one table called "Company". Here is how it functions.

Firts dropdown is the customer, next dropdown refelects
the divisions for that customer, the third dropdown
reflects only the jobsites in that division for that
customer.

I can go through and select the company, division, and
jobsite only one time because if I try to do it again
the "Jobsite" dropdown does not have data no matter what
company or divsion I choose from the first two dropdowns.
It's like its not re-accessing the fields or something.

Does this make sense. I can send you the database, its
small because I am just trying to figure things out right
now.

Thanks,
Greg
-----Original Message-----
I don't quite understand what you try to accomplish here,
Greg,

How many keys does the table have?
What is the role of the drop down fields in the form?
Where the information is coming from to your dropdown
fields..what is the RecordSource for them?

But, assuming that the table has only one key on
CustomerID field and you are trying to filter the records
by the value on CustomerID drop down field in the form,
here is the simple code that will make the trick.
(if you want a user to filter the records using all three
drop down fields you need to use different code)

Put a new dropdown field called cmbChosenCustomer on the
form.
Hide the CustomerID field that is connected to the table.
On Change Event of the cmbChosenCustomer field put this
code:

Private Sub cmbChosenCustomer_Change()
Me.Filter = "CustomerID = " & [cmbChosenCustomer]
Me.FilterOn = True
End Sub

next time when a user chooses Customer ID, your other
drop down fields will reflect relevent to Customer ID
info.

Was it helpful..or I just didn't get what you were asking?
-----Original Message-----
Can someone help me with a refresh on my 3rd dropdown?
When I go through all three drop downs and then want to go
back through the dropdowns once again, only the first two
will refresh and the third has no information.

Three fields in one table, custID, Division, Jobsite
three dropdowns - cboCust, cboDivision, cboJobsite

CODE:
Option Compare Database

Private Sub cboCust_AfterUpdate()

Dim strSearch As String


'For text IDs
strSearch = "[CustID] = " & Chr$(34) & Me![cboCust] &
Chr$(34)

'Find the record that matches the control.
Me.RecordsetClone.FindFirst strSearch
Me.Bookmark = Me.RecordsetClone.Bookmark

'requery the Division combox box so that it shows correct
information (given in the row source)
Me![cboDivision].Requery
Me.cboDivision.Enabled = True
Me![cboDivision].Value = "Select Division"

Me![cboJobsite].Requery
Me.cboJobsite.Enabled = True
Me![cboJobsite].Value = "Select Jobsite"


End Sub

Private Sub Form_Load()
Me.cboCust.Value = "select a customer"
Me.cboDivision.Enabled = False
Me.cboJobsite.Enabled = False


End Sub

Thank you,
Greg

.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top