Refresh form and open record

A

Alex

I have a form, which has a query containing left joins for a data source.
After I update a combo box field on the form, I need the other
controls/fields on my form to update. I have tried the following different
codes in the combo box field's AfterUpdate event and nothing works. I can
get the form to refresh, but it jumps to the first record. I can get the
form to refresh and open, but it filters the recordset to only the refreshed
record. Can someone please help. Thanks.

Me.Requery - does nothing
****************************************
Me.Dirty = False
DoCmd.OpenForm strDocName, , , strWhere - does nothing
*******************************************
strDocName = "NewPartInputfrm"
DoCmd.OpenForm strDocName, , , "[ID] = " & IDctr
- record refreshes and open, but it filters the recordset to only the
refreshed record.

End Sub
 
K

krocheck

Alex,

You will want to use the Requery method on each of the fields that you
need refreshed.

Me.ComboBoxName.Requery

Keith
 
J

J. Goddard

I'm not sure what you are trying to do here - are you using the combo
box the select (go to) a record that you want to display?

Or, if this is not the case, what do you want the other controls on the
form to update to?

John
 
A

Alex

combo box is a list of all parts from excelAtbl. ExcelAtbl is one of the
tables that is joined in my query with my main table. If a user picks
excelApart 12345 I want the Partweight, for example, which is a field in the
excelAtbl to update on my form. Thank you.

Krocheck's idea didn't work.

J. Goddard said:
I'm not sure what you are trying to do here - are you using the combo
box the select (go to) a record that you want to display?

Or, if this is not the case, what do you want the other controls on the
form to update to?

John

I have a form, which has a query containing left joins for a data source.
After I update a combo box field on the form, I need the other
controls/fields on my form to update. I have tried the following different
codes in the combo box field's AfterUpdate event and nothing works. I can
get the form to refresh, but it jumps to the first record. I can get the
form to refresh and open, but it filters the recordset to only the refreshed
record. Can someone please help. Thanks.

Me.Requery - does nothing
****************************************
Me.Dirty = False
DoCmd.OpenForm strDocName, , , strWhere - does nothing
*******************************************
strDocName = "NewPartInputfrm"
DoCmd.OpenForm strDocName, , , "[ID] = " & IDctr
- record refreshes and open, but it filters the recordset to only the
refreshed record.

End Sub
 
J

J. Goddard

Is Partweight a field in the query? If so, try putting
me![part weight field] = [Partweight]

Don't call the form control Partweight, it won't work if you do.

Did you try me.repaint? Can't guarantee it will work under these
circumstances - but it might.

John


combo box is a list of all parts from excelAtbl. ExcelAtbl is one of the
tables that is joined in my query with my main table. If a user picks
excelApart 12345 I want the Partweight, for example, which is a field in the
excelAtbl to update on my form. Thank you.

Krocheck's idea didn't work.

:

I'm not sure what you are trying to do here - are you using the combo
box the select (go to) a record that you want to display?

Or, if this is not the case, what do you want the other controls on the
form to update to?

John


Alex wrote:

I have a form, which has a query containing left joins for a data source.
After I update a combo box field on the form, I need the other
controls/fields on my form to update. I have tried the following different
codes in the combo box field's AfterUpdate event and nothing works. I can
get the form to refresh, but it jumps to the first record. I can get the
form to refresh and open, but it filters the recordset to only the refreshed
record. Can someone please help. Thanks.

Me.Requery - does nothing
****************************************
Me.Dirty = False
DoCmd.OpenForm strDocName, , , strWhere - does nothing
*******************************************
strDocName = "NewPartInputfrm"
DoCmd.OpenForm strDocName, , , "[ID] = " & IDctr
- record refreshes and open, but it filters the recordset to only the
refreshed record.

End Sub
 

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