link append query to combobox

I have a form (tester) that contains two unbound comboboxes. The first,
cboMRSearchChart looks up a specific ID number (text datatype) for a patient,
and the second (cboDOVSearchChart), displays the dates of visit associated
with that ID number. The two fields are from the table "Patient Visits,"
where an autonumber Chart ID serves as the primary key. The selection of a
date updates a subform (sbfPatientVisits), which is related to the mainform
via Chart ID number. The column with Chart ID is present in the Date of Visit
combobox, but is hidden from view.

In the NotInList event of the DOV search combobox, I would like to run an
append query that will add the new patient ID number/date of visit
combination to the "Patient Visits" table. Ideally, this would also update
the subform to display the new entry for date of visit and would allow users
to add information to the rest of the fields in the subform.

I have almost no experience with VBA, but I'm wading my way through it.
Here's the current code that I've adopted from another post:

Private Sub cboDOVSearchChart_NotInList(NewData As String, Response As
Integer)
Response = acDataErrContinue
Call Date_Not_Found(NewData)
End Sub

Public Sub Date_Not_Found(NewData)
Dim ans As Variant

' add date
gbl_exit_name = False

ans = MsgBox("The date you entered was not found. Do you want to add a new
date?", _
vbYesNo, "Add New Date?")

If ans = vbNo Then
Me.cboDOVSearchChart = Null
DoCmd.GoToControl "cboMRSearchChart"
GoTo exit_it
End If

' add date
If ans = vbYes Then
DoCmd.OpenQuery "qryAddVisit"

Me.Detail.Visible = True
Me.sbfPatientVisits.Visible = True
[Forms]![sbfPatientVisits].[DateofVisit].SetFocus
End If
exit_it:

End Sub

The query SQL is as follows:
INSERT INTO [Patient Visits] ( [Medical Record Number], [Date of Visit] )
SELECT Forms!tester!cboMRSearchChart, Forms!tester!cboDOVSearchChart AS
Expr1;

Everything seems to be working well, however, running the query only adds the
medical record number (with a new Autonumber) to the Patient Visits table.
Also, the subform appears blank (not entries in any of the fields, including
date of visit). Any advice that could help me straighten this out would be
greatly appreciated.

Kevin

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200707/1

0
Kevin
7/25/2007 6:09:28 PM
access.queries 6343 articles. 1 followers. Follow

0 Replies
1278 Views

Similar Articles

[PageSpeed] 9

Reply:

Similar Artilces:

appending to CEdit
I have a CEdit control and I want to append text to it as follows: void CSerialPortDlg::debugf(char* format, ...) { char buf[4096]; // should be big enough va_list arglist; va_start( arglist, format ); vsprintf( buf, format, arglist ); va_end( arglist ); if( GetSafeHwnd() && m_edit.GetSafeHwnd() ) { m_edit.LineScroll( m_edit.GetLineCount() ); m_edit.SetSel( -1, 0, TRUE ); m_edit.ReplaceSel( buf ); } } This works fine until there is a lot of text in the CEdit control. After, oh I don't know, maybe 64k of data or so, it no longer adds any...

custom entity + linking contact
Hi, I am new to the CRM product. And have a few questions...... I know that in 3.0 you can create custom entity, but can you link your custom entity to other entity such as contact/account? In defining the custom entity, there's a relationship field and mapping field. What are they exactly? When/How do you define a relationship/mapping? Thanks, Jane You can create relationships to other entities when you create a new custom entity in 3.0. I believe that you can also establish if the new custom entity maps up to an existing entity, or receives mapped info from an existing entity. -...

Deleting "mail to:" email address links
I have a relativly straight forward spreadsheet where I am maintaining a large address list. It contains a homeowner's lot number, name, address, telephone #, and e- mail address. When attempting to select random cells for data entry/modification, I receive and automated message " mailto: (a random e-mail address) - click once to follow. Click and hold to select this cell." I have no idea where/how this message/feature/function is being attached to these cells but would like to eliminate it. Since seeing these messages, the size of the worksheet has been increasing in ...

RPC over HTTP/S on Exchange 2003
I have been configuring my single server with exchange to use RPC over https I have followed the instructions in MS guide and another simplified guide at http://www.petri.co.il/configure_rpc_over_https_on_a_single_server.htm Server spec is: Server 2003 standard SP1, Exchange 2003 SP1, XP client SP2 with outlook 2003 sp2 The bottom line is that when testing from the WAN, the outlook client will not connect and say that the exchange server is unavailable. I have a lot of experience configuring rpc over http/s with sbs2003 but this is the first time for server 2003 standard. I have outlook ...

Summing in A Query
Hello, I have a database which fuel records are stored in. The data is stored in two tables. The first records the daily logs that operators use each time they fuel up. It stores their name, the key they used (keylock fuel system - it's ancient) the unit number of the equipment using the fuel, and the amount of fuel they took. The second table stores the month end information retrieved from the key lock print out. It keeps a running total of the amount of fuel taken with each key, and the operator using that key. We have problems making sure all of the fuel is accounted for each mon...

Query fields
Is it possible to write a criteria where the value of an empty field is "0.00"? Background: I have three queries with different customer account groups. Not every salesperson has customer accounts in every accountgroup - so, he will not shown up in that query. But he has accounts included in another query. Now, I would like to get a sum of commission earned by each salesman calculated from all three queries together. Since the salesman has no record in one query the total sum of that specific salesman is not shown. Any idea how to solve that problem? Thanks Klaus On Wed, 29 A...

How to create an "and" rule in Query Based Distribution Groups
Hi, With Exchange 2003 Query Based Distribution groups, is it possible to create an "and" rule? ie, all users who are based in "London" "and" have the first name "John"? Thanks, Curtis. -- Please reply to news group only. Thank you. Sure. (&(attribute1=blah)(attribute2=blah)) http://msdn.microsoft.com/library/en-us/adsi/adsi/search_filter_syntax.asp?frame=true -- Bharat Suneja MCSE, MCT www.zenprise.com blog: www.suneja.com/blog ----------------------------------- "Curtis Fray" <xxx@xxx.com> wrote in message news:OjVc...

Finding all queries which use a table
Hi, Does anyone know of a tool that can scan all queries in a database and find if a certain table is used? I have a table called tblCustomerRollup which is old and outdated. I want to see which of the 500 queries in my database use this table without opeing every single one of them? Thanks, -- Chuck W Chuck Sounds like a variation on Search/Replace. Try searching online for "Database Documenter" as a starting point. A couple of the commercial tools I've used include FMS, Inc.'s Total Access Analyzer and Black Moshannon's Speed Ferret. There are a lot of fr...

Query to hide duplicate records
I recall that this used to easy in previous versions (Unique values only ??), but in 2007, I can't get this to work at all. I have a table with our companie's job numbers in it. The job numbers show up multiple times because of different phases of the project: ProjNum ProjDescription 3077 Univ. of Vermont/UC/LEED 3077 Univ. of Vermont/University Commons: Building Fee 3077 Univ. of Vermont/University Commons: Excess Professiona... I need to jut have a single listing of each project number, otherwise, I get repeated records in the query that looks at this information (which ...

OWA Error for http links
links inside a message body always generate an asp redirect code that does not execute at all thus giving an http 500 error - page not found. Example on a link to http://www.nightlight.org within a mail body. http://orange/exchweb/bin/redir.asp? URL=http://www.nightlight.org/ Exchange Server 2003 running on Server 2000 SP4 PLease help. ...

Simple Access counting queries
Hi, hoping someone can help a relative newbie with a pretty simple query. My database (Access 2007) has three tables: Customers Products Purchases (many-to-one links to both of the other tables, this is basically a linking table) I have two simple queries I'd like to get out of this database, but I'm a bit stuck on how to construct the SQL. Any direction you can give me would be helpful. 1. List of all customers who have purchased 2 or more products (or 3 or more products, or 4+, etc.) 2. List of all customers who have purchased both Product A and Product B (or A, B, and C, or B an...

Linking Basic Beancounting spreadsheets?
I am new to Excel (and this forum) & want to make my own General Ledger, Monthy Synopsis, Trial Balances, Financial Statements etc. for a new business. I am reading _Basic_Beancounting_ by T. James Cook and wish to use Excel efficiently. (Just learned how to group tabs to make multiple identical forms. Works great and saves a pile of time!) Now I want to take the debit & credit totals from each account column in the monthly synopsis sheet and link them (automatically post) them to the appropriate column in their individual running totals of each General Ledger Account. The problem...

command for breaking link in excel is not seen.
i have copied files containing fromulas to another file. while opening the new file, each time, it is asking whetehr to update the data from parent file. I wish to break the link in second file, but could not find the command for that. while opening links, it shows only three commands, which odes not include command for ' breaking links'. Hi Suresh, If the links are no longer required, delete the link formulae or convert them to values. You may find Bill Manville's FINDLINK.XLA addin useful This is freely downloadable at: http://www.oaltd.co.uk/mvp --- Regards, ...

Problem with vba code to export query result in excel
Hi, I have a access report that exports to excel with click of a button after choosing parameters. This works well. However I have to modify couple of fields to utilize formula in the export module. I am not sure how to do this. I am writing the above code which seems to cause problem. I appreciate any help to resolve this issue. Thanks. Code: If lngColumn = 12 Then xlc.Offset(0, lngColumn).Value = =([UnitPrice]*[OriginalShippedQty])/1000 End If It seems the fields UnitPrice and OrigianalShippedQty are not being recognized here Jack wrote: >Hi, >I have a acces...

ComboBox with AutoCompleteMode = SuggestAppend and custom search (Contains)?
Hi, I have a class FlightStation with a Search property that combines two attributes. I like to search not only for matching strings from the beginning, but rather from any where in the string. (With the Contains method or the string class) What is the best and quickest solution to implement such a search when using a combobox and not a TextBox for the input? I know about implementing a derived class like this: class FlightStationBindingList : BindingList<FlightStation> { // ... } But is there a more quick and dirty solution ?! - Sorry :-) My solution with the Tex...

Can you link 2 worksheets together?
Say i have one worksheet and on my second one I want to reference cells from the first one? is there a formula for that>? To create a simple link: Select a cell in the second worksheet Type an equal sign Select the first sheet Click on the cell that you want to link Press the Enter key. Alesha wrote: > Say i have one worksheet and on my second one I want to reference cells from > the first one? is there a formula for that>? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Difficult query
Hi, I have a table called WT,contains the fields "Type of call","DateW" and "ID", this table is used to by users to add rows that determine type of calls received in a call center,I want to create a query with the following criteria: 1- To view number of calls received in each type per day. 2- To show the field "Type of call" in this query,even the type that wa not used,and to view number 0 in the count field. 3-Prcentage of each type of call . On Dec 11, 3:52 pm, Pietro <Pie...@discussions.microsoft.com> wrote: > Hi, > I have a tabl...

Setting Text in a ComboBox
Hi, Does anybody know why I cannot set the text in the edit control of a CBS_DROPDOWN style CombBox control using SetWindowText()? I was able to change the text in the edit control part of the ComboBox manually. Thanks, Vincent. I don't know why can't you? Post some code. You should be able to m_MyCombo.SetWindowText("The Text"); Ali R. "Vincent Yu" <anonymous@discussions.microsoft.com> wrote in message news:5e2b01c3ad48$5309d630$a601280a@phx.gbl... > Hi, Does anybody know why I cannot set the text in the > edit control of a CBS_DROPDOWN style ...

modify linked cells without breaking link
I have a workbook with a number of worksheets (2003.) The 2nd and 3rd worksheets have cells that are linked to the 1st worksheet. This workbook will be used to schedule production. The 1st worksheet has a list of products that we produce. The 1st worksheet has a column for the min # of cases we need to keep in stock at all times and the max # of cases we must keep in stock at all times. The 1st worksheet also contains a column where the production scheduler would enter the actual # of cases in stock. The 2nd worksheet in the workbook takes the actual cs in stock and compares ...

Report Query in RMS
Is there somewhere that I could get some information as to how the reports in RMS are composed. When you look at the various reports they all seem fairly simple in there basic structure. Are the any examples of how these reports are composed. The //--- Columns ---// iformation seems to be the same in most reports, same as the //--- Title Rows ---//. Setting up the flitters and the TablesQueried I need to understand. I have the schema for 1.2. How do I better understand the following or what do I need to learn. I wish I was in college again and had all the time in the world. //--- Repo...

Can I embed or link multiple .pdf files into or to an excel file?
I would like to link .pdf files to an excel file. Within my excel file I would like to have a column that has file names in it. Then have excel link those files to the excel file so when I print the excel file all the linked files print along with it. use hyper link "GrubbyG" wrote: > I would like to link .pdf files to an excel file. Within my excel file I > would like to have a column that has file names in it. Then have excel link > those files to the excel file so when I print the excel file all the linked > files print along with it. ...

VBA and SQL Query
hi, i use GP 8.0 and i want to make a custom form for a specific need. i cannot use Dexterity for this change so i really need to use VBA. however in the vba form i want to make a few sql select queries to pull client names, and call a table view, and eventually run a few update queries. is that possible to do with VBA in GP 8.0 ? Yes. You need to create an ADO connection and execute through that. Go to Customersource and search for ADO and VBA. Somewhere, I think in one of the demo links, is a file containing sample code that show you how to do this, including use of the retrievegl...

link file from virtual windows xp to access 2007 on windows 7 plat
I am trying to link a paradox db file to access 2007 db. The paradox file resides on a virtual windows xp platform within the windows 7 platform of the physical machine. How do I map this field into access? -- cblackman ...

pass through query variables
Hi Guys, I am looking for some help with a pass through query. I have a number of reports that allow users to select values from combo box's and want to know how I can pass this data in a pass through query. I have looked through and searched but seem to just get sites that I have to register to get some details, but do not wish to register elsewhere to get some info. If any has an example or links to any sites that would cover this I would appreciate it. An example of what I would want to pass is [forms]![frmReports].[txtsupplierID] [forms]![frmReports].[txtprod...

MS Query
This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C3998F.CE542560 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Currently I have a number of MS Queries connected to an Oracle DB = through the ODBC. We have had to change the user name and password for = accessing the database so I need to change the queries. How? The ODBC setup on the PC has been changed but each of the queries still = access via the original id, is there a way in the query editor to change = these details? --=20 Regards Dean=20 dkso@ntlworld.com...