Hi guys,
Hopefully I am not asking for to much here. On my main form [Patients], its source is from a qry [Qry_All_Patients], which is created from table[Tbl_All_Patients]. I would like to add a combo box [cboOption] which has 2 choices. They are review & completed.
Is there a simple code I can enter in the AfterUpdate of the combo box which will append the [Acct#, PTname, PTFNCLS] from the main form to a table.
I have done append queries before but that appends alll the accounts.
Thank you again for any help anyone can provide.
4 1711 PEB 1,418
Expert 1GB
So if you want to append only the current record you should specify a complementary line
WHERE (ID="+str(Me!ID)+");"
Or if there is no query based on a table you have only specify a table where add the information
just like:
INSERT INTO mylove(A,b,C)
SELECT "Judie" AS A , "Angelika" AS B, "Susie" AS C;
Without mention anything else
And just one record with those names will be insertted!
;)
HI PEB,
Thanks for replying, you have to forgive me but my vb programming skills is not good at all. Please be patient with me. I enter the code below into the AfterUpdate event of the combo box but it did not work. If you coud please look at it and tell me what needs to be changed.
Private Sub cboOption_AfterUpdate()
DoCmd.RunSQL "INSERT INTO Tbl_Analysis(ACCT#, PTName, PTFNCLS, Activity_code)
SELECT “ACCT#” AS ACCT#, “PATIENT NAME” AS PTName, “F_C” AS PTFNCLS, “cboOption” AS Activity_code;"
End Sub
Thanks for all your help.
PEB 1,418
Expert 1GB
HI PEB,
Thanks for replying, you have to forgive me but my vb programming skills is not good at all. Please be patient with me. I enter the code below into the AfterUpdate event of the combo box but it did not work. If you coud please look at it and tell me what needs to be changed.
Private Sub cboOption_AfterUpdate()
DoCmd.RunSQL "INSERT INTO Tbl_Analysis([ACCT#,] [PTName], [PTFNCLS], [Activity_code])
SELECT “+str(Me![ACCT#])+” AS ACCT#, '“+me![PATIENT NAME]+”' AS PTName, '“+me![F_C]+”' AS PTFNCLS, '“+me!cboOption+”' AS Activity_code;"
End Sub
Thanks for all your help.
I suppose that
Me![ACCT#] is a field in your form and it is a number
The next fields are also fields from your form but are string /text so u see what happens with the string
As your SQL is a string you need to add the corresponding strings
To refer to your strings in form in the current form i use Me![Field] as u noticed!
:)
Thanks PEB for all your help. I think I got it.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: John |
last post by:
Hi - I am trying to perform a simple append query, with no luck. I
have a table (MktPrices) that has the following fields: BondID,
PriceDate, Price. The objective is to allow the user to input a...
|
by: Danny |
last post by:
I want to extract a subset of fields from one table into another
the master table has many fields
the subset has about half, but still many.
Is there a way I can just append the master into the...
|
by: Aaron |
last post by:
Hello fellow programmers,
I am trying to run an append/update query from code, a command button
on a form initiates the queries.
the format i am using is;
...
|
by: Larry Rekow |
last post by:
As part of a macro, I'm trying to automate appending a table with new
records.
let's say the table 2 has some new records in it, but also has a lot
of identical records to table 1.
I would...
|
by: David Barger |
last post by:
Greetings,
It appears that an Append Query I run in Access XP is randomly failing
to append a field.
I have payroll data being entered into a payroll database. This data
is exported daily to...
|
by: robboll |
last post by:
When I try to use an append query from an oracle link it takes forever.
I am exploring the idea of doing an append action using a pass-through
query.
If I have an Oracle ODBC connection to...
|
by: MN |
last post by:
I have to import a tab-delimited text file daily into Access through a
macro. All of the data needs to be added to an existing table. Some of
the data already exists but may be updated by the...
|
by: pmacdiddie |
last post by:
I have an append query that needs to run every time a line item is
added to a subform. The append writes to a table that is the source
for a pull down box. Problem is that it takes 5 seconds to...
|
by: pythonnoob |
last post by:
Hello everyone. New to python as well as this forum, but i must say ive learned a but already reading through some posts. Seems to be a pretty helpful community here.
Before i post a question...
|
by: Scott12345 |
last post by:
Hi, here is my situation, I have a DB that tracks machine downtime (30 machines) per day. Several users will update this through the day. I created an append query that creates 30 dummy values and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |