Using ADO - having problems requering rest of form

Tiffini

Registered User.
Local time
Today, 15:23
Joined
Feb 13, 2004
Messages
20
:confused:
I am using the code from FAQ "Adding New Entries to Table From a Combobox (ADO)" in my combo box which works fine. However, the choice from the combobox finds a record for the rest of the form, and when a new record is added...it doesn't requery the entire form. What code do I need to add and where do I need to add it?

Thanks,
T.
 
Try adding this line at the end of the ADO sub's code...

Code:
Me.Requery
 
Mile-O-Phile said:
Try adding this line at the end of the ADO sub's code...

Code:
Me.Requery


Initialy I tried Forms!FormName.Requery at the end of the code, right before End Sub - with no success. I just tried Me.Requery, and still no luck. The other fields in the form still hang on to values from another record.

Looks like this:

Err_ErrorHandler:
' display error message and error number
MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
Resume Exit_ErrorHandler

Me.Requery

End Sub

Any other suggestions?

Thanks,
Tiffini
 
Why are you wanting to requery the form with the code in that FAQ, anyway? It's for adding a record to a table that doesn't currently appear in in the combobox. The recordset of the form shouldn't be the same as the combobox.

Can you explain exactly what you are trying to do?
 
Mile-O-Phile said:
Why are you wanting to requery the form with the code in that FAQ, anyway? It's for adding a record to a table that doesn't currently appear in in the combobox. The recordset of the form shouldn't be the same as the combobox.

Can you explain exactly what you are trying to do?


In the form, there is a combo box that you choose a contact from and it pulls up related info about that contact in the other fields. I want to use the same form for the user to input a New contact, and their info from an Add Record command button. The user is able to edit the contact info in the fields, so if they can add a new contact name in the combobox (using the ADO code), and the other fields requery to blank (using the requery form code)...they can also add the rest of the contact info to the form without closing the form, and opening it back up.
Maybe there is a better way, but I don't know VBA well enough to come up with other alternatives.

Thanks,
Tiffini
 

Users who are viewing this thread

Back
Top Bottom