Create Recordset From Combo Choice

Jun 2, 2005

I have a table called Contacts and a form with two combo boxes for searching for records either by name or property name. The following code works fine for finding the first record, but I want to be able to show on the form all (and only) those records which match the combo box entry. Currently rowsource for name box is:
************************************************** *
SELECT [Last Name1] FROM Contacts UNION SELECT [Last Name2] FROM Contacts
ORDER BY Contacts.[Last Name1];
************************************************** *
and code is:
************************************************** *
Private Sub Combo214_AfterUpdate()
' Find the record that matches the control for Last Name search
Dim rs As DAO.Recordset

Set rs = Me.Recordset.Clone
rs.FindFirst "[Last Name1]= '" & Me.[Combo214] & "' OR [Last Name2]= '" & Me.[Combo214] & "'"
rs.FindNext "[Last Name1]= '" & Me.[Combo214] & "' OR [Last Name2]= '" & Me.[Combo214] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Combo214.Value = ""
txtFirstName1.SetFocus
End Sub
************************************************** *
Rowsource for property box is:
************************************************** *
SELECT Contacts.PropertyID, Contacts.PropertyName
FROM Contacts
ORDER BY Contacts.PropertyName;
************************************************** *
and code is:
************************************************** *
Private Sub Combo212_AfterUpdate()
' Find the record that matches the control for Property Name search
Dim rs As dao.Recordset

Set rs = Me.Recordset.Clone
rs.FindFirst "[PropertyID] = " & Str(Nz(Me![Combo212], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Combo212.Value = ""
cboPropertyName.SetFocus
End Sub
************************************************** **

Any help is appreciated!

View Replies


ADVERTISEMENT

How Do I Create Mutiple Choice Questions

Apr 21, 2007

I'm making a project in VB, and I need it to link to a Database,I already know how to do this
the project is a bit like who wants to be a millionaire with all the questions in an access table,
I know I need the following fields;

the auto number
the question
Answer A
answer B
answer C

the problem is I need to be able to select which answer is correct ?

View 1 Replies View Related

Using Access To Create Document From Multiple Choice Options

Mar 23, 2013

I currently write (very long) reports for work, which have a lot of standard text in them - but the standard text varies according to the client's history.

I want to create a report-writing application for myself, composed of series of yes/no/maybe buttons
and depending on whether I click yes/no/maybe in each section, a different segment of text is inserted into the report.

Ideally the application would be able to insert, or create, formatted text - such as headings, bullet point lists etc - I would need to be able to export this report into Word

I started out by making a table, with each section being a different field, and the various paragraph options as different cells in the field, but I am stuck at present on the basic functionality of "click button , insert text"...

View 3 Replies View Related

Set A Default Choice In A Combo Box

Jun 14, 2006

I used a combo box to let user select "Proejct Status" such as active, completed, cancled. I want to set active as a default selection if user does not choose other status. How can I do that? Thank you very much for your help.

View 2 Replies View Related

How To Change A Value With Choice In A Combo Box

Oct 21, 2013

i have a two column that one stores a professions and other stores a number of the profession like that:

number
professions

1
singer

2
police man

3
teacher

"number" column is a combo box, that boundColumn property is two.

i want that in the form when i choose a value in a combo box i will see the profession in other text box in my form.if i choose 2 in combo box i see in a other text box in my form police man.

View 4 Replies View Related

Inserting A Value Based On Combo Box Choice

Jun 29, 2005

Hi all,

I have a main form containing client details (tbl_Client) and a sub form containing notes (tbl_notes). tbl_Notes contains a foreign key field (Client_ID) which is obviously the primary key in tbl_Client.

The client is chosen on the main form using a combo box where the user selects the clients name. the id is not visable to the user. How can i get it so that the id (Client_ID) of the selected user is inserted into the Client_ID field of tbl_notes.

Thanks

View 6 Replies View Related

Figuring Different Calculations Per Choice In Combo Box

Oct 3, 2005

Hello, I have a combo box called (cboridge) bound to a table called (Ridge)with two fields/columns called (dollar amount) (Material type)with 4 different options/records, when the user selects his option/field the dollar amount shows stays visible in the (cboridge) combo box Then I have a text box called (txtridgetot) that has a calculation in it, but I need different calculations per option/field that's picked. Can each option/record that is chosen have a different calculation associated with it in the (txtridgetot) text box.

In other words if the user selects the third option/field called shake ridge could I have a calculation that would run and have it display the sum of this calculation in the text box (txtridgetot).

If so could you please describe how?

Thanks-- Any help will be greatly appreciated.

View 6 Replies View Related

Figuring Different Calculations Per Choice In Combo Box

Oct 3, 2005

Hello, I have a combo box called (cboridge) bound to a table called (Ridge)with two fields/columns called (dollar amount) (Material type)with 4 different options/records, when the user selects his option/field the dollar amount shows stays visible in the (cboridge) combo box Then I have a text box called (txtridgetot) that has a calculation in it, but I need different calculations per option/field that's picked. Can each option/record that is chosen have a different calculation associated with it in the (txtridgetot) text box.

In other words if the user selects the third option/field called shake ridge could I have a calculation that would run and have it display the sum of this calculation in the text box (txtridgetot).

If so could you please describe how?

Thanks-- Any help will be greatly appreciated.http://forums.aspfree.com/newthread.php?do=newthread&f=18#
Hello!

View 1 Replies View Related

Forms :: Set Date Depending On Choice From Combo Box / Option Buttons

Mar 30, 2015

I'm looking to have either a combo box,, or 2 options buttons (whichever is easiest) that set a date field based on what is selected in the combo box/ option buttons.

The variables are 'Payment in 30 days" " Payment upfront"

if "payment in 30 days" is selected the date field on the form will enter the date as + 30 days from todays date
if "payment upfront" is selected the field on the form will enter todays date.

This date field must be blank unless an option is selected, as this information is only entered in a later stage of the form.

I've tried a few different ways to enter this but i can't quite get it to work as i want.

View 3 Replies View Related

Forms :: Update Record Based On Combo Box Choice And Related Tables?

Jun 3, 2014

In my database I have a table that keeps track of a package of items. The package is assigned a package type (counter display, end cap, half pallet, full pallet for example). The record of the association of the package and it's type is held in the main table.

Each of these package types is either a case or a pallet (counter display and end cap are cases and half and full pallets are pallets) This relationship is kept in another table (we will call it description table).

Now, based on the type of package and therefore it being a case or pallet a UPC and a GTIN number are assigned. The GTIN number is different if it is a case or is a pallet. I have a table that stores all of the UPC and GTIN numbers available in 3 columns, one for UPC, one for GTIN Case and one for GTIN Pallet (the UPC is a standard 12 digit and the GTINs are 14 digit -with the first 2 different to designate pallet or case. and all are based on the check digit formula necessary)

The user assigns the UPC and correct GTIN number by clicking a button which applies the next available UPC code to the package and determines if the description of the type (case or pallet) and inserts correct GTIN number into that field. I actually have all of this functioning correctly.

Now the problem. If a user changes the package type, and therefore changes the description, I need to add code to the update event of the combo box that gives the choices for package type that does the following:

Check to see if the original package type was a case or pallet (it's description) and if by changing the package type it is now changed to the other, update the record in the main table to the correct GTIN number based on the existing UPC Code.

OR as I write this, maybe the code could simply update the main table with the correct GTIN code based on the new description and the existing UPC code. This was I would not need to check for a change just do the update every time.

View 14 Replies View Related

Create A Recordset From A Recordset

Aug 17, 2007

from a table with fields userID and Date (in which any userID has multiple records with different Date values, and other fields) i have built a select query based on Date = one specific value. can anyone give an explanation (for beginners), through a sample code, that expands the query recordset so that the new recordset includes all records per userID that qualified in the prior recordset? below is an example. thank you!

Table with records:
userID / Date
u1 / d1
u1 / d2
u2 / d1
u2 / d2
u3 / d2
...
1st Select Query (where Date = d1):
u1 / d1
u2 / d1

Desired 2nd Query based off 1st Query (where ?):
u1 / d1
u1 / d2
u2 / d1
u2 / d2

View 3 Replies View Related

Create Recordset

Jan 17, 2005

What is the easiest way to get the results from a query?
I now create an empty form and set the sql-statement as the recordsource, but this means I can't open two forms simultaniously because they use the same subform.
I know how to creat an ado-recordset, but this would mean the client needs to install extra dll's, my client doesn't have those (I want the program to work on a pc that has access installed and nothing more).

There must be an easier way...

Another problem I have is that when access is closed the MSACCESS proces keeps running, is this a bug, can I have caused this?

With any other access file this is not the case, but they do not have an autoexec.

Please help
Yvonne

View 1 Replies View Related

Create Table From A Recordset

Mar 27, 2007

Hi,
I'm trying to create a new table from another existing two in vba. I'm using this code without success... Any help will be gratefully taken.
---------------------
Dim strSQL as string
Dim tablaSuma As DAO.TableDef
Dim rst As DAO.Recordset

strSQL = "SELECT * FROM Necesidades_TRS1, Pedidos WHERE Pedidos.Código=Necesidades_TRS1.Código"
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
Set tablaSuma = CurrentDb.CreateTableDef("TablaSum")
For Each Campo In rst.Fields
tablaSuma.CreateField(Campo.Name, DB_SINGLE) = Campo
Next
----------------------
Mike

View 8 Replies View Related

I Just Want To Create A Recordset (Runtime Error 424)

Jul 21, 2007

Why does the following code generate an error. All i want to do is open a recordset which I thought would be straightforward. (novice Programmer, new to access vba). The set statement in the ComboProduct event generates the error.

Option Compare Database
Dim Company As String
Private dbaProposal As DAO.Database
Dim EffectiveDate As Date
Dim Product As String
Private rstProposal As DAO.Recordset

Private Sub ComboProduct_AfterUpdate()
Product = ComboProduct.Value
Set rstProposal = dbsProposal.OpenRecordset("SELECT * FROM Proposals WHERE Proposals.[Group Name]='" & Company & "' AND Proposals.[Effective Date]=#" & EffectiveDate & "# AND Proposals.Product='" & Product & "'")
End Sub

Private Sub Form_Load()
Set dbsProposal = DBEngine.OpenDatabase("Database1.accdb")
End Sub

View 2 Replies View Related

Modules & VBA :: Create Recordset From List Box

Sep 3, 2014

Is it possible to create a record set from a list box?

I have two list boxes list1 (customers) the can transfer records to list2. I want to take all records from list2 and use it to open a report, using customer id as where clause in my docmd.openreport statement.

View 4 Replies View Related

Modules & VBA :: Create A Recordset For Multiple Emails And Send One Email

Mar 17, 2014

I have some code that takes from a query, an email address and sends out an email.Due the security warning that happens for each individual email, i want to create ONE email for all email address in the query and populate them to the BCC section of the sendobject.Here is the code that I currently use

Code:
Private Sub cmdSendEmail_Click()
Dim MyDB As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String

[code]...

I want to populate the BCC field with multiple emails addresses seperated by ":" and send just one email.

View 4 Replies View Related

Create A Query With Derived Field Based On Each Change In Recordset

May 5, 2013

I need to come up with a way to derive field X (see below) in a query.

For each change in field A, Set X=1
For each change in field B, X=X+1

The below table shows what the query results should look like.

A
X
B

[code]....

View 2 Replies View Related

Recordset Update From Combo

Jul 17, 2006

I want to update a field (field1) in each record of a recordset (qryUpdate)

I got the following code (in green) working fine - so far so good. I actually need to update the field from a selection from an unbound combo box. This looks up a table with two fields Period ID (autonumber PK) and a text field called Quarter. I've tried various combinations including the code in red and code such as
"rst![field1] = Me.cboPeriod"
"rst![field1] = Me.cboPeriod.Column(0).value" etc

but can't get it to work. It has to be something simple but I can't see it.


Private Sub cboPeriod_AfterUpdate()
Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset("qryUpdate")
Do Until rst.EOF

If IsNull(rst![field1]) Then
rst.Edit
rst![field1] = 5
rst.Update
End If

rst.MoveNext
Loop
End Sub




Private Sub cboPeriod_AfterUpdate()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("qryUpdate")

Do Until rst.EOF

If IsNull(rst![field1]) Then
rst.Edit
[rst![field1] = Me.cboPeriod.Column(0)
rst.Update
End If

rst.MoveNext

Loop

End Sub

View 3 Replies View Related

ADO Recordset Populate Combo Box

Sep 26, 2005

hi all,

not sure if this is the correct forum but here goes. is it possible to have a disconnected ADO recordset populate a combo box in an Access Project (.adp)? i have a Access XP front end piping back to a SQL Server 2k dbase. i'm using a stored procedure to handle my insert, however i have a couple of combo boxes on my data entry form that i need to populate on the form's "OnLoad" event. i was wondering if i can populate these using a disconnected recordset (similar to functionality of the dataset object in ADO.NET)?

if not any ideas of best practices to populate combo boxes and limit connection resources?

many thanks for any suggestions.

View 5 Replies View Related

Recordset Filter Combo Box

Oct 18, 2005

Hi There. Im Trying To Filter Records Through A Combo Box Which Is So Far So Good. However What I Would Like To Do Is Select The Records Through The Combo Box And Have It Return And Populate Only Those Records. Has Anyone Got Any Suggestions To This?
Ive Attached The Sample Database Im Working On.

Cheers

View 3 Replies View Related

Binding Recordset With Combo Problem

Feb 26, 2005

Hello Everyone,
I am stuck in a problem for many days now.
In the form, on which I am working, there are 2 dropdown lists (combo box).
The data in the first combo is coming from a list and in the second combo, I am running a query, and depending upon the selection in the first combo, the data in the second combo may come from one of many tables in the database.
What I want is to have control over the data, before it is being displayed in the second combo, as the data in have many null and 'same name' entries. But what I don't want is to change the original data in the tables.

Till now, I have been trying to make use of persistant recordset, that is, by storing the recordset in an external table, changing its data and binding it to the second combo. But I am unable to bind the data.

What in your opinion, is the best approach to accomplish this. A snippet will be of great help as I am not a experienced programmer.

regards

View 1 Replies View Related

Retrieve Data From Backend - Update Combo Box From Recordset

Dec 12, 2011

I have written code to retrieve data from a back-end, that is then bound to a form (late binding forms).

From the retrieved record set I want to update a combo box using 1 field from the data in the record set, only showing unique records in the list.

View 5 Replies View Related

Modules & VBA :: How To Extract Recordset From Subform Into Recordset Object

Aug 14, 2015

Special situation: The SQL Server Linked Server across the country is linked to a Read Only Oracle DB. This data pull works perfectly and populates the Subform.

The problem is that Oracle can take 3 to 6 seconds to retrieve the single record depending on the network traffic through a small pipe.

The code below shows the RecordSource for the SubForm. clicking on a list box supplies the value. Then 3 to 6 seconds later, the subform populates.

The actual Recordset for this Recordsource is needed to conduct Validation on each field. Normally this would be on SQL Server, I might just create a Recordset Oject and run this SQL statement again in 1 milisecond. In this case, it will probably take an additional 3 to 6 seconds. Avoiding another lengthy round-trip to Oracle would be prefered.

Goal: How does one grab, clone, or other wise reference the existing recordset for the SubForm?

Note: Immediate Window - One single field can be returned quickly

There are 48 fields that need validation - is there a way to reference the entire recordset?

Immediate Window during Break Mode:
? me.fsubsrNavSHLBHL("NavSH_QQ")
NESE ' this is the correct value for the current recordsource

Set a breakpoint right after the line:
fsubsrNavSHLBHL.Form.RecordSource = "Select * from vsrNavigatorSHLBHL where Well_ID =" & txtNavWellID.Value

Immediate Window:
? me.fsubsrNavSHLBHL.Form.RecordSource
Select * from vsrNavigatorSHLBHL where Well_ID =91229

View 4 Replies View Related

How Do I Create A Combo Box Of Fields

Mar 21, 2006

Hi everyone, first off, I did a search of "combo box fields" and it turned up some results but after going through them, I still didn't think it answered my question.

I want to create a combo box of fields from a table. After selecting a field, I want to choose from another cbo either "Yes" or "No" to fill out that particular field.

How do I do that? Thanks all.

View 5 Replies View Related

How To Create Combo Box Filter

Dec 7, 2012

I`m using access 2010 version, i have one table(Customer) which has one-to-many relationship to the table(Order), so the Order table contains many records from one single record in Customer. How to create a combobox that filter and show how many orders the Customer has. Example:

Table(Customer)
Line 1 - Crystal

Table(Order)
Line 1 - Water
Line 2 - Cookies
Line 3 - Pens

View 4 Replies View Related

Multiple Choice

Feb 14, 2008

I have a query which check assignement of vehicles.
Is it possible to have combo box with all employee names ,and acording to that choice to execute query.
So when i open my report I want to be asked to pick name of 1 employee in drop down menu and then get his records.
If its doable please be gentle cause i am new in all this
thx

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved