Recordset.Clone AfterUpdate Fail

optionone

Registered User.
Local time
Today, 13:30
Joined
Feb 11, 2010
Messages
56
Hi,

Still rather new to visual basic and I had the following working for a bit but it has stopped now and I dont understand what has changed (nothing from what i have done besides aesthetics of the form) or what has gone wrong.

Code:
Private Sub findpatientname_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[HospitalNo] = '" & Me![findpatientname] & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Have a multi-page form with a combobox control called findpatientname in the form footer which looks up a patient register table - i want this to show the record selected from the control on the various pages using HospitalNo as a means of selecting a patient

Any thoughts as to what I could look in to as to why it no longer works?

Many thanks
 
Recreate the combo box. Drop it on the form footer and on the first page of the wizard select the third option. Follow the wizard till the end.
 
Recreate the combo box. Drop it on the form footer and on the first page of the wizard select the third option. Follow the wizard till the end.
Didnt work - have checked the names of the controls on the form as well - do i need to re-create the form?
 
Meaning it doesn't do anything or it throws an error?

Is the form bound? Or are you using a subform?
 
Meaning it doesn't do anything or it throws an error?

Is the form bound? Or are you using a subform?
Doesnt do anything - page1 of the form doesnt have a subform - page2 does

form is bound to the patient register table that the control is looking up
 
Let's see a stripped down copy of your db. Indicate which form is the problem form.
 
appreciate the help vbaInet - db attached

form in question is called mainmenu
 
Last edited:
Two things:

1. Instead of using the table as the Record Source of your form, use a query. So the query should simply have:
Code:
SELECT [main-patient-info].* FROM [main-patient-info];
2. In the property sheet of your form, under the DATA tab you had the DATA ENTRY property set to Yes. Change it to No. There was nothing wrong with the combo.
 
Two things:

1. Instead of using the table as the Record Source of your form, use a query. So the query should simply have:
Code:
SELECT [main-patient-info].* FROM [main-patient-info];
2. In the property sheet of your form, under the DATA tab you had the DATA ENTRY property set to Yes. Change it to No. There was nothing wrong with the combo.
Thanks for the help - if i could ask one more favour of you? on the database i have provided - could you change the data entry property and view the form?

As soon as i do that it crashes access - i tried rebuilding the entire database but then minor changes to the form make it crash again
 
I believe that form is corrupt, but this is how you do it.

1. Make the change
2. Close the form and wait for the Save prompt. Then click Yes to Save.

It won't crash that way.

To get rid of the corruption I will advise two things:

1. Create a brand new database shell, import all your objects into that database. Then Compact & Repair the new db.

Or

2. Try the SAVE OBJECT AS option and save the form as a new form. Copy and paste the code from the old form module into the new form module.
 

Users who are viewing this thread

Back
Top Bottom