Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate Second Form Based On First Form

Status
Not open for further replies.

WickedElm

MIS
Jul 11, 2002
13
US
Hi there, I am trying to create two different forms that are to be used together...On the first form there is a text box, "txtnumber", where users enter a number to look up a certain record...when a button on the form is pushed, i want a second form to pop up with data corresponding to the record number they entered on the first form...an example...if they put in the number 007, then the second form's controls would be pointed to 007's record for things like "Name", "Address", etc...I can bring up the second form, but can't get it to point to the information entered on the first form...ANY help would be greatly appreciated....thanks!!!

boris
 

hi ther

DoCmd.OpenForm "frmname", , ,"FieldtoFilter = " & me!txtnumber


FieldtoFilter is thename of the field in the table on your 2nd form and me!txtnumber is the bound textbox on your first form.


hope this helps


jo
 
I have an additional question to add to this. I am doing this also but I want to create a menu toolbar with a button that will open the second form. Is there a way to get this code to the toolbar?
 
Using the office assistant
I typed
adding a function to a toolbar
then selected adding a command to a menu

which brought up this - you can get it the same way and then be able to follow the hyperlinks


Add a custom command that runs a Visual Basic function to a menu
Create the function you want the command to run.
How?

On the View menu, point to Toolbars, and then click Customize.


If it isn't already displayed, show the menu bar, shortcut menu, or toolbar containing the menu that you want to add the command to.
How?

In the Customize dialog box, click the Commands tab.


In the Categories box, click File.


Drag the Custom command from the Commands box over the menu on the menu bar or the toolbar, or under the appropriate category on the Shortcut Menus toolbar. When the menu displays a list of menu commands (or an empty box if it's new), point to the location where you want the command to appear on the menu, and then release the mouse.


With the Customize dialog box open, right-click the command on the menu, and then on the shortcut menu, type a new name for the command in the Name box.


On the same shortcut menu, click Properties.


In the On Action box, type the name of the function you want to run in the format =functionname(). For example, for a custom function named SetCaption(), type =SetCaption(). For a built-in function, enter the name of the function and any required arguments, for example =MsgBox(IIf(Instr(Time(), "PM"), "Good Afternoon", "Good Morning")).


Specify any other properties for the command.
Note If you add a command to a built-in menu (for example, the Edit menu), that command appears in all views having that built-in menu.


regards


jo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top