Using a multi select list box to open several records in a
pre - defined form. Most of the code that follows is taken
from a posting by Alan Browne on his web site. The click
routine is supposed to loop thru all of the reports, or in
this case records, selected in the list box & display them
for previewing or editing. In my situation it only displays 1
record in the form & does not perform the necessary loop.
Have tried futzing with it but getting no where fast.
Hoping someone can direct me to a solution. Below is the onclick() vb code:
Private Sub Command5_Click( )
On Error GoTo Err_Handler
Dim varItem As Variant
Dim strWhere As String
Dim strDescrip As String
Dim lngLen As Long
Dim strDelim As String
Dim strDoc As String
strDoc = "EditClipFr m"
With Me.List12
For Each varItem In .ItemsSelected
If Not IsNull(varItem) Then
strWhere = strWhere & strDelim & .ItemData(varIt em) & strDelim & ","
strDescrip = strDescrip & """" & .Column(1, varItem) & """, "
End If
Next
End With
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[ID] IN (" & Left$(strWhere, lngLen) & ")"
lngLen = Len(strDescrip) - 2
If lngLen > 0 Then
strDescrip = "clipname: " & Left$(strDescri p, lngLen)
End If
End If
DoCmd.OpenForm strDoc, acNormal, WhereCondition: =strWhere
Exit_Handler:
Exit Sub
Err_Handler:
If Err.NUMBER <> 2501 Then
MsgBox "Error " & Err.NUMBER & " - " & Err.Description , , "cmdPreview_Cli ck"
End If
Resume Exit_Handler
End Sub
Thanks as always for any advice on this
dc 6 1950
doncee <no************ *****@charter.n et> wrote in
news:Xn******** *************** **@216.196.97.1 31: Using a multi select list box to open several records in a pre - defined form. Most of the code that follows is taken from a posting by Alan Browne on his web site. The click routine is supposed to loop thru all of the reports, or in this case records, selected in the list box & display them for previewing or editing. In my situation it only displays 1 record in the form & does not perform the necessary loop. Have tried futzing with it but getting no where fast. Hoping someone can direct me to a solution. Below is the onclick() vb code:
This line is wrong: DoCmd.OpenForm strDoc, acNormal, WhereCondition: =strWhere
try,
DoCmd.OpenForm strDoc, acNormal,,strWh ere
from the help file:
expression.Open Form(FormName, View, FilterName, WhereCondition,
DataMode, WindowMode, OpenArgs)
--
Bob Quintal
PA is y I've altered my email address.
Bob Quintal <rq******@sympa tico.ca> wrote in
news:Xn******** **************@ 207.35.177.135: doncee <no************ *****@charter.n et> wrote in news:Xn******** *************** **@216.196.97.1 31:
Using a multi select list box to open several records in a pre - defined form. Most of the code that follows is taken from a posting by Alan Browne on his web site. The click routine is supposed to loop thru all of the reports, or in this case records, selected in the list box & display them for previewing or editing. In my situation it only displays 1 record in the form & does not perform the necessary loop. Have tried futzing with it but getting no where fast. Hoping someone can direct me to a solution. Below is the onclick() vb code:
This line is wrong: DoCmd.OpenForm strDoc, acNormal, WhereCondition: =strWhere try, DoCmd.OpenForm strDoc, acNormal,,strWh ere
from the help file: expression.Open Form(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)
Thanks for the reply, however I am still getting the same results. The form
opens but only for 1 of the highlited records. I am hoping to open as many
instances of the form as lines I have highlited in the listbox. If I have 4
lines highlited then I would like those 4 records opened in the selected
form. Does this make sense?? Thanks again for your reply.
dc
doncee <no************ *****@charter.n et> wrote in
news:Xn******** *************** **@216.196.97.1 31: Thanks for the reply, however I am still getting the same results. The form opens but only for 1 of the highlited records. I am hoping to open as many instances of the form as lines I have highlited in the listbox. If I have 4 lines highlited then I would like those 4 records opened in the selected form. Does this make sense??
The OpenForm code you used will open only one instance of the form with a
recordset of X records, equal to the number of items selected.
If you are sure that the WhereCondition returns more than one record, you
need a way to navigate through the the recordset, either custom controls or
the native navigation buttons.
Richard Bernstein
doncee <no************ *****@charter.n et> wrote in
news:Xn******** *************** **@216.196.97.1 31: Bob Quintal <rq******@sympa tico.ca> wrote in news:Xn******** **************@ 207.35.177.135:
doncee <no************ *****@charter.n et> wrote in news:Xn******** *************** **@216.196.97.1 31:
Using a multi select list box to open several records in a pre - defined form. Most of the code that follows is taken from a posting by Alan Browne on his web site. The click routine is supposed to loop thru all of the reports, or in this case records, selected in the list box & display them for previewing or editing. In my situation it only displays 1 record in the form & does not perform the necessary loop. Have tried futzing with it but getting no where fast. Hoping someone can direct me to a solution. Below is the onclick() vb code:
This line is wrong: DoCmd.OpenForm strDoc, acNormal, WhereCondition: =strWhere try, DoCmd.OpenForm strDoc, acNormal,,strWh ere
from the help file: expression.Open Form(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)
Thanks for the reply, however I am still getting the same results. The form opens but only for 1 of the highlited records. I am hoping to open as many instances of the form as lines I have highlited in the listbox. If I have 4 lines highlited then I would like those 4 records opened in the selected form. Does this make sense?? Thanks again for your reply. dc
Your form will open filtered to the records in your list. you
must use the navigation buttons at the bottom of the form to
move between each record, or redesign the form to show multiple
records.
--
Bob Quintal
PA is y I've altered my email address.
doncee wrote: Using a multi select list box to open several records in a pre - defined form. Most of the code that follows is taken from a posting by Alan Browne on his web site. The click routine is supposed to loop thru all of the reports, or in this case records, selected in the list box & display them for previewing or editing. In my situation it only displays 1 record in the form & does not perform the necessary loop. Have tried futzing with it but getting no where fast. Hoping someone can direct me to a solution. Below is the onclick() vb code:
Private Sub Command5_Click( ) On Error GoTo Err_Handler
Dim varItem As Variant Dim strWhere As String Dim strDescrip As String Dim lngLen As Long Dim strDelim As String Dim strDoc As String
strDoc = "EditClipFr m"
With Me.List12 For Each varItem In .ItemsSelected If Not IsNull(varItem) Then
strWhere = strWhere & strDelim & .ItemData(varIt em) & strDelim & ","
strDescrip = strDescrip & """" & .Column(1, varItem) & """, "
End If
Next
End With
lngLen = Len(strWhere) - 1 If lngLen > 0 Then strWhere = "[ID] IN (" & Left$(strWhere, lngLen) & ")" lngLen = Len(strDescrip) - 2 If lngLen > 0 Then strDescrip = "clipname: " & Left$(strDescri p, lngLen) End If End If
DoCmd.OpenForm strDoc, acNormal, WhereCondition: =strWhere
Exit_Handler: Exit Sub
Err_Handler: If Err.NUMBER <> 2501 Then MsgBox "Error " & Err.NUMBER & " - " & Err.Description , , "cmdPreview_Cli ck" End If Resume Exit_Handler End Sub
Thanks as always for any advice on this dc
As Bob said, you might need to set the navigation buttons on. If you
want you could pass an argument to the form if you don't want nav
buttons in certain conditions.
DoCmd.OpenForm strDoc, , , strWhere, , , "Test"
Then in the OnOpen event enter something like
Me.NavigationBu ttons = (Me.OpenArgs = "Test")
Me.AllowAdditio ns = Not (Me.OpenArgs = "Test")
If this is not the situation, then add the following code
msgbox strWhere
prior to opening the form. The code you provided us looks OK...not sure
what strDescrip is...but you should be getting a multiple record list.
salad <oi*@vinegar.co m> wrote in
news:kJ******** *******@newsrea d2.news.pas.ear thlink.net: Thanks as always for any advice on this dc
As Bob said, you might need to set the navigation buttons on. If you want you could pass an argument to the form if you don't want nav buttons in certain conditions. DoCmd.OpenForm strDoc, , , strWhere, , , "Test"
Then in the OnOpen event enter something like Me.NavigationBu ttons = (Me.OpenArgs = "Test") Me.AllowAdditio ns = Not (Me.OpenArgs = "Test")
If this is not the situation, then add the following code msgbox strWhere prior to opening the form. The code you provided us looks OK...not sure what strDescrip is...but you should be getting a multiple record list.
Thanks to all who replied. Yes, in fact I do have the filtered
records that I was trying to produce, but I was unknowingly
canceling the form before cycling thru the records. It is clear
now what is happening. Thanks again for all of your help.
dc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Charles Alexander |
last post by:
Hello
I am new to php & MySQL - I am trying to retrieve some records from a MySQL
table and redisplay them. The data in list form looks like this:
Sample_ID Marker_ID Variation
G23_NA17192.fsa rs7374540 A/C
I23_Control.fsa rs7374540 C/C
|
by: Les Juby |
last post by:
I have an application which loops through several thousand subscriber
records, compares each subscriber's requirements to a database of
businesses for sale, and then prepares and mails off an email
containing info from the database that the client is interested in.
Problem is that the ASP file exits as soon as it has sent about 50 or
so records to the Mercury/32 mail server on the local Ethernet. No
error message or program execution...
|
by: Eric Martin |
last post by:
Hello,
Does anyone know of a way to loop thru a SQL table using code in a stored
procedure?
I need to go thru each record in a small table and build a string using
values from the fields associated with a part number, and I can't find any
way to process each record individually. The string needs to be initialized
with the data associated with the 1st record's part number, and I need to
build the string until a new part number is...
|
by: Jeremy Langworthy |
last post by:
Hi
I have a dynamicly generated form (well the elements are at least)
that looks something like this:
while( not end of returned records):
<input name="plan_id" type="checkbox" id="" value="<?=
$row_plans->planid ?>">
|
by: Radu |
last post by:
Hi. It seems to be very simple, actually, but I don't know if it is
feasible in TSQL. I have a sproc which gathers in one place many calls
to different other sprocs, all of them taking a 'StoreGroupe'
parameter. I would like to add a case where if the call has NO
StoreGroupe parameter, the sproc should LOOP thru all records in table
StoreGroupeTable, read the column StoreCode, and pass that value as a
param to the other sprocs, as in:
...
| |
by: fniles |
last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataAdapter.
For every record in tblA where colB = 'abc', I want to update the value in
colA.
In VB6, using ADO I can loop thru the recordset,set the values of colA and
call the Update method.
How can I do this in VB.NET and SqlDataAdapter ? Thank you.
m_cmdSQL = New SqlClient.SqlCommand
With m_cmdSQL
.Connection = adoCon
|
by: =?Utf-8?B?VmFuZXNzYQ==?= |
last post by:
Here is my loop and it runs fine:
----------------------------------------------------
sSQL = "SELECT * FROM STORE_ITEMS"
Set DataRec = DB.execute(sSQL)
if not DataRec.EOF then
do while not DataRec.EOF
SKU = trim (DataRec("SKU"))
ITEM_ID = trim(DataRec("ITEM_ID"))
...
|
by: SaltyBoat |
last post by:
Needing to import and parse data from a large PDF file into an Access
2002 table: I start by converted the PDF file to a html file. Then
I read this html text file, line by line, into a table using a code
loop and an INSERT INTO query. About 800,000 records of raw text.
Later, I can then loop through and parse these 800,000 strings into
usable data using more code.
The problem I have is that the conversion of the text file, using a...
|
by: sausthav |
last post by:
Hi All,
I am unable to get the excel open when user select two dates from my code. Previously i was successfully extracting values by selecting year and month values from the webpage. Could you help me out in writing the Access 2003 SQL query to resolve my issue. Looking forward to your help and support:) I am giving the snapshot of my code:
<%@Language=VBScript%>
<%
Dim TmplXls
Dim DestXls
Dim DB
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |