How would I do this...

Gemini32

Board Regular
Joined
Feb 9, 2003
Messages
51
Hi Folks

I've been a very busy bee with my work order and I'm so excited after the help from Corticus (thank you so much) I didn't have a clue what or how the requery worked...So I did research with the help files in mdb....I then found out that you can use Shift + F9 ...this is what I found the requery was said it could do ........
( Requery action to update the data in a specified control on the active object by requerying the source of the control. If no control is specified, this action requeries the source of the object itself. Use this action to ensure that the active object or one of its controls displays the most current data.)

I designed my work order and then copied the work order in the query to make a new query called Update... What this query will do for me was it would multiply 25% to the Unit Price in my Work Order Form.....
So in my form work order I made a command button using the update query to input the different price....

Well up to now I had very many unsuccessfuls tries of making it do what I had wanted it to do....Till now....I never created a macro before or worked in VB before so that was like a foreign language to me...hahhaha....
But now I finally was able to run my form work order the way I wanted it to...

This is what I've done created the command button for the update query using the wizard in the form design on the toolbar......When I return to the form I input the data then I press Shift + F9 then my update button and then click in the next textbox and it does all the calculation for me....

I'M SO THRILLED IT FINALLY WORKED FOR ME THANKS AGAIN CORTICUS FOR THE HELP

My question is can I make a command button using the wizard to do the action of Shift + F9 ..Instead of pressing the two keys at the same time..But to be able to click a button and go through the procedure for me......I'm going to be pluging away at it so any help would be very much appreciated......

:D Gemini32 :D
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi Gemini, glad it worked for you!

I believe Shift+F9 performs the action DoCmd.Requery, which is not necessarily the best route. Docmd.requery is like closing the form, and then reopening it, which can eat up memory and make you db run slow. You also lose you 'place' in the recordset, which is a real pain.
But, to attempt to answer, you do not need to use the wizard to perform a requery with a button. The wizard allows for a 'refresh data' button, which will perform the action of selecting 'records|refresh', or DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70, which I believe will give you the same issues as the docmd.requery command. I would suggest to open your form on which you want the button, insert a button, and cancel the wizard thing. Right-click on the button, and select 'build event' and then 'code builder'. You should see:
Code:
Private Sub Command1_Click()

End Sub

You want to add your control requery like so:
Code:
Private Sub Command1_Click()

[MyForm]![Control1].requery

End Sub

You might have to change the manner in which you reference the control depending on from where you reference it, and where it is located. Post back if you trouble with this part, and let me know what the referencing situation is. (from form to subform, subform to form, etc)

HTH,
 
Upvote 0
Hi Corticus

Thank You very much Corticus...I'll do that and I'll get back to you if I need some help....

Gemini32

Ok I went in the form (design view) and brought up the wizard and then cancel it and did what you said to do this is what I got when I went and built the code.....


Compile Error:

Qualifier must be collection

What does that mean? Help....
 
Upvote 0

Forum statistics

Threads
1,221,497
Messages
6,160,151
Members
451,625
Latest member
sukhman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top