Hey room, in Access 2000 in the VB part. Im trying to open a form after selcting a value from a list box. Once you select the value you click a button which then opens a form with the details from the list box on it. The list box is called list15 and the button command12. The form has not been created yet as there is alot of work to be done!
Thanks for your help.
Dave
4 10529
You need to use the OpenArgs method. Create your listbox and a command button. Behind the command button place this code.
Dim strFormName As String
Dim stLinkCriteria As String
strFormName = "MyForm"
DoCmd.OpenForm strFormName, , , , , , Me.MyListBox
Don't forget to change the form name and listboxname. Next, in the forms, that you are opening, ON LOAD event place this code.
Me.MyTextBox = Me.OpenArgs
Again, change the name of the text box that is on the form.That should do it. By the way, you don't need a command button. Place the first section of code in the After Update event of the list box.
You need to use the OpenArgs method. Create your listbox and a command button. Behind the command button place this code.
Dim strFormName As String
Dim stLinkCriteria As String
strFormName = "MyForm"
DoCmd.OpenForm strFormName, , , , , , Me.MyListBox
Don't forget to change the form name and listboxname. Next, in the forms, that you are opening, ON LOAD event place this code.
Me.MyTextBox = Me.OpenArgs
Again, change the name of the text box that is on the form.That should do it. By the way, you don't need a command button. Place the first section of code in the After Update event of the list box.
what do the dots in DoCmd.OpenForm strFormName, , , , , , Me.MyListBox mean? i would need some detail if you could please?
MMcCarthy 14,534
Recognized Expert Moderator MVP
To open a form to a specific record you need to pass the criteria using the following format. In the code FormField is the field on the form that holds the data matching the listbox.
DoCmd.OpenForm FormName, , , WhereCondition -
-
Private Sub Command12_Click()
-
DoCmd.OpenForm "FormName", , , "[FormField]=" & Me.List15
-
End Sub
-
-
MMcCarthy 14,534
Recognized Expert Moderator MVP
DoCmd.OpenForm FormName, , , WhereCondition
By the way the commas in this statement stand for parameters we don't need. You need to put them in to show the WhereCondition statement
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: jdph40 |
last post by:
I have a form in Access 97 on which I have an unbound list box filled
with our employees names from tblEmployees. When you select an
employee's name and click a button, the following code is run...
|
by: Simon Rowe |
last post by:
Probably really simple but I cant work it out...
I have a list box on a form with a few records in. When I open the form the
first record is sort of highlight with a dashed box, when I cursor...
|
by: Brian Basquille |
last post by:
Hey there all,
Fairly easy question for a C# expert, i assume! Am still working on my Photo
Album.
On frmBrowsePhotos, i have a listBox (photosList) containing photoID's from
a table in an...
|
by: Paradox |
last post by:
Hey,
I'm trying to figure out what situations call for the use of a derived
form control such as:
public class myListBox : System.Windows.Forms.ListBox
and what situations call for the use...
|
by: Alpha |
last post by:
Hi,
I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a
listbox that I have binded to a dataset table, "source" which has 3 columns.
I would like to display 2 of those...
| |
by: baret bonden |
last post by:
Trying to return a selected listbox item to another form .tried lots of
ways; defining public variables and passing those as well as textboxes ..I'
m able to display the chosen item on it's form...
|
by: Work007 |
last post by:
i am using visual basic express edition and i am very new to it.
I have a form 1 which has a textbox. User adds something to this textbox and clicks on the ADD button. User is taken to form 2 and...
|
by: EManning |
last post by:
I''m having problems getting a form to open while going from one tab
to another. I have a tab control: one tab for counties and one tab
for cities. Both tabs have multi-select listboxes. If...
|
by: lukasmazur |
last post by:
Hi
I have a problem with using listBox1. I have a two forms form1 and
form2. In form1 are controls listBox1, textBox1 and button witch
creating object of class Form2. In class Form2 I create a...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |