Hello All,
(newbie)...I'm working on an Ordering app using the typical tables (customers, orders). I have a Search form to find existing customers prior to entering a new order. On the search form there's a combo control called 'custname' so that when a customer is located, the existing customer name is filled in and the account number goes into the Account control (from an autonumber field called CustomerID from Customer table). The rest of the data for street, city, etc go into the associated controls. So far no prob, I can click the cmd button (to begin new order), open the 'Order' form and pass the control data just fine, to the Order form.
On 'Search' form there's a 'NotInList' event with the 'custname' control, it opens another form called [Add or Delete Customer] by a double-click event. No problem there because on the the AutoNumber gets assigned to a new customer name and the rest of the data associated with the customer get stored appropriately.
On the Search form the problem comes in when I click the 'Edit Customer' cmd button to change information on an existing customer after a customer is located. the 'Edit Customer' button also opens the [Add or Delete Customer] form and passs the controls data. But something really wierd happens..... The CustomerID Account number passes into Customer Name control (on [Add or Delete Customer] form and the the account number (which is bound to CustomerID Autonumber) complains about duplicates. I suspect because the control is bound to CustomerID, which was fine when adding a new customer, but not for editing.
I have an 'AfterUpdate' event (recordset) associated as well with 'custname' but I don't think it's the problem.
I've been trying to figure this out for days and can't get it worked out. If anyone has encountered this before, please offer some suggestions,,,, ,thanks in advance,,,,,,I' m over my head. Here's the code: - Private Sub custname_DblClick(Cancel As Integer)
-
Me.[custname] = ""
-
DoCmd.OpenForm "Add or Delete Customer"
-
End Sub
-
- Private Sub custname_NotInList(NewData As String, Response As Integer)
-
MsgBox "The Name you entered is not found" & _
-
vbCrLf & "Double Click to add a new customer", _
-
vbInformation, "The name is not found"
-
Response = DataErrCont
-
End Sub
-
- Private Sub custname_AfterUpdate()
-
Dim rst As Object
-
-
Set rst = Me.RecordsetClone
-
-
rst.FindFirst "Customers.[CustomerID]=" & Me![custname]
-
If Not rst.NoMatch Then
-
-
Me.Bookmark = rst.Bookmark
-
Else
-
'Not found!
-
End If
-
-
End Sub
-
This is code used for the 'Edit Customer' button - Private Sub createcust_Click()
-
DoCmd.OpenForm "Add or Delete Customer"
-
'The event to open the Order form with some controls filled in
-
Forms![Add or Delete Customer]![fullcustomer].Value = Forms![Search a Customer]![custname]
-
Forms![Add or Delete Customer]![companies].Value = Forms![Search a Customer]![compname]
-
Forms![Add or Delete Customer]![BillingAddress].Value = Forms![Search a Customer]![abilladdress]
-
Forms![Add or Delete Customer]![newstateorprov].Value = Forms![Search a Customer]![astateOrprovince]
-
Forms![Add or Delete Customer]![City].Value = Forms![Search a Customer]![City]
-
Forms![Add or Delete Customer]![Title].Value = Forms![Search a Customer]![thetitle]
-
Forms![Add or Delete Customer]![thezippostal].Value = Forms![Search a Customer]![ZIPCode]
-
Forms![Add or Delete Customer]![acountry].Value = Forms![Search a Customer]![acountry]
-
DoCmd.Close acForm, "Search a Customer", acSaveNo
-
End Sub
-
- Private Sub BeginOrder_Click()
-
DoCmd.OpenForm "Add an Order and Details"
-
'The event to open the Order form with some controls filled in
-
Forms![Add an Order and Details]![thefullname].Value = Forms![Search a Customer]![FullName]
-
Forms![Add an Order and Details]![TheCompany].Value = Forms![Search a Customer]![compname]
-
Forms![Add an Order and Details]![custacct].Value = Forms![Search a Customer]![custaccts]
-
Forms![Add an Order and Details]![ShipAddress].Value = Forms![Search a Customer]![ShipAddress]
-
Forms![Add an Order and Details]![thecountry].Value = Forms![Search a Customer]![acountry]
-
Forms![Add an Order and Details]![ShipCity].Value = Forms![Search a Customer]![ShipCity]
-
Forms![Add an Order and Details]![BillingAddress].Value = Forms![Search a Customer]![BillingAddress]
-
Forms![Add an Order and Details]![ShipStateOrProvince].Value = Forms![Search a Customer]![ShipStateOrProvince]
-
Forms![Add an Order and Details]![ShipZIPCode].Value = Forms![Search a Customer]![ShipZIPCode]
-
DoCmd.Close acForm, "Search a Customer", acSaveNo
-
End Sub
-
So sorry to bombard with information ,but I thought it might clarify what's going on. thanks.
Rosie,,,,,,I've got to get some sleep..thanks
4 2356 MMcCarthy 14,534
Recognized Expert Moderator MVP
What is the record source of the "Add or Delete Customer" form?
What is the record source of the "Add or Delete Customer" form?
Hi Mccarthy,
The record source is 'qrySearchCusto mer' based off of the Customers table, which has all the fields required. thanks.
Rosie
MMcCarthy 14,534
Recognized Expert Moderator MVP
Try this ... -
Private Sub createcust_Click()
-
'createcust is not a great name as this is for editing a customer already in existance
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "Add or Delete Customer"
-
stLinkCriteria = "[CustomerID] = " & Me.custname
-
' This will only work if the CustomerID is the bound control on the custname combobox
-
DoCmd.Open Form stDocName, , , stLinkCriteria
-
-
End Sub
-
Try this ... -
Private Sub createcust_Click()
-
'createcust is not a great name as this is for editing a customer already in existance
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "Add or Delete Customer"
-
stLinkCriteria = "[CustomerID] = " & Me.custname
-
' This will only work if the CustomerID is the bound control on the custname combobox
-
DoCmd.Open Form stDocName, , , stLinkCriteria
-
-
End Sub
-
Thanks so much....it worked beautifully. take care
Rosie
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: zlatko |
last post by:
There is a form in an Access Project (.adp, Access front end with SQL
Server) for entering data into a table for temporary storing. Then, by
clicking a botton, several action stored procedures (update, append) should
be activated in order to transfer data to other tables.
I tried to avoid any coding in VB, as I am not a professional, but I have
found a statement in an article, that, unlike select queries, form's Input
Property can't be...
|
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {
document.images.src = eval("mt" +menu+ ".src")
}
alert("imgOff_hidemenu");
hideMenu=setTimeout('Hide(menu,num)',500);
|
by: Joel |
last post by:
Hi all,
Forgive me if I've expressed the subject line ill.
What I'm trying to do is to call a c++ function given the following:
a. A function name. This would be used to fetch a list of function
descriptors for the overloaded functions of that name. A function
descriptor would contain the address of the function to be called, and
a description of the parameters that it must take.
b. A list of parameters. This would be compared to the...
|
by: Harolds |
last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005
the pmID is evaluated to "" instead of what the value is set to:
....
xmlItems.Document = pmXML
// Add the pmID parameter to the XSLT stylesheet
XsltArgumentList xsltArgList = new XsltArgumentList();
xsltArgList.AddParam("pmID", "", pmID);
xmlItems.TransformArgumentList = xsltArgList;
|
by: Mike MacSween |
last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime
ago.
Then remembered that arguments are passed by reference, by default.
Does the fact that this slowed me down indicate:
a) That I don't know enough
b) Passing arguments by ref is bad
| |
by: Charles Sullivan |
last post by:
The library function 'qsort' is declared thus:
void qsort(void *base, size_t nmemb, size_t size,
int(*compar)(const void *, const void *));
If in my code I write:
int cmp_fcn(...);
int (*fcmp)() = &cmp_fcn;
qsort(..., fcmp);
then everything works. But if instead I code qsort as:
|
by: Punker |
last post by:
Hi guys,
I am trying to create export specifications for one of my queries. Now when I run the query on its own, it works perfectly. However when I try to export the data I get back the error message "Too few parameters. Expected 1." Has anyone encountered this before? Below is my SQL statement in case it helps:
SELECT ClaimDetail.cd_ClaimId, BatchMaster.bm_BatchId, ClaimDetail.cd_BatchId, ClaimDetail.cd_ClaimNum,...
|
by: Swinky |
last post by:
I have a form "AccountInfo" that contains company names. I have
inserted a subform "Contacts" with contact names and have established
parent/child relationships between the two forms. All works well.
I created an "Add New Contact" command button which passes the
CompanyID (unique key set to autonumber) to the new record. This
successfully works if the parent record (AccountInfo) has at least one
existing contact. But if there are no...
|
by: csmith8933 |
last post by:
How do I write a function where the number of parameters it takes
varies?
This is what I have but it doesnt work.
// function prototype
void functionThree(int num1=1, int num2=2, int num3=3);
int main()
{
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: 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: 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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |