URGENT: Spllting a form

Noreen

Registered User.
Local time
Today, 22:39
Joined
Sep 27, 2010
Messages
30
Spllting a form

Hi there,

I had help designing this form with the following code:

Option Compare Database
Private Sub Combo12_AfterUpdate()
Me.Competency = Null
Me.Behaviour = Null
Me.Competency.Requery
End Sub
Private Sub Command50_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Progress_Report"
DoCmd.RunMacro "mac_Progress_Update"
End Sub
Private Sub Competency_AfterUpdate()
Me.Behaviour = Null
Me.Behaviour.Requery
End Sub
Private Sub RepName_AfterUpdate()
Me.Training.Requery
End Sub
Private Sub Teamlead_AfterUpdate()
Me.RepName = Null
Me.RepName.Requery
End Sub
Private Sub Teamlead_Enter()
Me.Teamlead = Null
Me.RepName = Null
Me.Belt = Null
Me.Competency = Null
Me.Behaviour.Requery
Me.TrainingDone = Null
Me.TeamLeaderRating = Null
Me.TeamLeaderComments = Null
Me.Training.Requery
End Sub




It is a form which is for a competency matrix. I would like to split this form into 2 pieces. I have a training completed list box that is dependent on RepName, I would like this to be in a seperate form and the user clicks a button to be directed to this new form. I have tried copying and pasting this but I am recieving errors.

Can anyone please help me with this? I have little experience with SQL but I'm ok with access.

Thanks in advance for your help
 
Last edited:
Two issues here

1. Marking your thread URGENT is not going to get it answered any quicker
2. You say you are experiencing errors, but what errors are you getting. It would help to know.
 
Two issues here

1. Marking your thread URGENT is not going to get it answered any quicker
2. You say you are experiencing errors, but what errors are you getting. It would help to know.

Ok to address the issues:

1. My job may depend on it! I apologise if it offended anybody.
2. I am recieving errors when I copied it:
Option Compare Database
Private Sub Combo12_AfterUpdate()
Me.Competency = Null
Me.Behaviour = Null
Me.Competency.Requery
End Sub
Private Sub Command50_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Progress_Report"
DoCmd.RunMacro "mac_Progress_Update"
End Sub
Private Sub Competency_AfterUpdate()
Me.Behaviour = Null
Me.Behaviour.Requery
End Sub
Private Sub RepName_AfterUpdate()
Me.Training.Requery
End Sub
Private Sub Teamlead_AfterUpdate()
Me.RepName = Null
Me.RepName.Requery
End Sub
Private Sub Teamlead_Enter()
Me.Teamlead = Null
Me.RepName = Null
Me.Belt = Null
Me.Competency = Null
Me.Behaviour.Requery
Me.TeamLeaderRating = Null
End Sub

When I click the training completed button it jumps to visual and puts the above in yellow highlight (red here) and says:

Compile Error
Method or Data Membor Not Found

Any help would be much appreciated

P.S Apologies I'll change it from urgent
 
Last edited:
Check what the control TRAINING is. I suspect it's a label control.
 
I think the author of that code was trying to requery a combo box or a list box. In the meantime highlight that line of code by prefixing it with a single quote, like this:

Code:
[B][COLOR=Red]'[/COLOR][/B][COLOR=red][COLOR=Black]Me.Training.Requery[/COLOR][/COLOR]
 
I think the author of that code was trying to requery a combo box or a list box. In the meantime highlight that line of code by prefixing it with a single quote, like this:

Code:
[B][COLOR=red]'[/COLOR][/B][COLOR=red][COLOR=black]Me.Training.Requery[/COLOR][/COLOR]

That's great thanks a million but yes he was but it's important that it is requered as the list box needs to be updated everytime a new rep is clicked. However at the moment you have to close the new report to update it and then reopen it.

Is there anyway that this can be requered?

This is returning all the results of the query and I want the repname matched. It's really importand
 
Find the name of the combo/listbox that he intended to requery and replace it with Training.
 
I have located this and it is named training but I moved this list box into a new form called Training Done, this list box is no longer located in this form.
I wanted the new forms joined by a button.

From my understanding
in the code do I need to change this:

Me.? training. requery

Is Me. refering to the present form? How can I change this to a different form?

Thanks a million for your help
 
Ah, so it was you moving things around that caused the problem :)

It depends on where the code currently resides. In the main form?

And whether this new form is a subform in the main form?
 
Ah, so it was you moving things around that caused the problem :)

It depends on where the code currently resides. In the main form?

And whether this new form is a subform in the main form?

Yea but my manager decided on a redesign and the guy that helped me has practically left - only cut down to one day a week

Basically -

Everything was in one form - now I want to split it into two: These are my steps so far:

I copied the Training Done List Box into a new form and called it Training Done.

I created a button to open the form Training Done in the first form.

Now I am recieving the above error


What are my next steps to fix this?

Thanks a million for your help!
 
The only thing I can advise at this stage is how to refer to the listbox:

Forms("Name of Form").Controls("Name of listbox").Requery

Fixing this could lead to other problems because I don't know how the author designed the db and how things flow. Copying the listbox from one form to another doesn't carry along the code (if any) that was attached to it. So my suggestion would be to wait until he's around.
 
The only thing I can advise at this stage is how to refer to the listbox:

Forms("Name of Form").Controls("Name of listbox").Requery

Fixing this could lead to other problems because I don't know how the author designed the db and how things flow. Copying the listbox from one form to another doesn't carry along the code (if any) that was attached to it. So my suggestion would be to wait until he's around.

Yea I will probably but I would really like to have a go myself! so just a quick question - I did the above and it says:

Run-time error "2450":

Microsoft Access can't find the form "Training Done" refered to in a macro expression or visual basic code.

I followed what you said but obviously done something wrong - any ideas?
 
Like the error says, there could only be two possibilities:

1. The form is not called Training Done

OR

2. The form is not a separate form but a subform embedded within your main form.
 
Like the error says, there could only be two possibilities:

1. The form is not called Training Done

OR

2. The form is not a separate form but a subform embedded within your main form.

It's definitely saved as Training Done so this means it s called it right?

So that only leaves subform - I inserted a button to open training completed does that make it a subform?
 
Private Sub RepName_AfterUpdate()
Forms("Training Done").Controls("Training").Requery
End Sub
 
I also forgot to mention that the form MUST be opened before running the code.
 

Users who are viewing this thread

Back
Top Bottom