473,625 Members | 3,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to update form

DK
Please can somebody help me ?

I have forms named Form 1, Form 2 etc. having fields
CustomerName,Cu stomerAddress,. ....

Id like to have button on each form ,which will open another form named
"CustomerAd d" with list of all customers in tblCustomers. After I pick one
of the customers from the list, actual form should be closed and details of
customer shall be send to fields in Form 1 or Form2 or...

Thank You

D
Nov 13 '05 #1
3 1471
Br
In news:d4******** **@ss405.t-com.hr,
DK <da***********@ coxris.hr> said:
Please can somebody help me ?

I have forms named Form 1, Form 2 etc. having fields
CustomerName,Cu stomerAddress,. ....

Id like to have button on each form ,which will open another form
named "CustomerAd d" with list of all customers in tblCustomers. After
I pick one of the customers from the list, actual form should be
closed and details of customer shall be send to fields in Form 1 or
Form2 or...


One method would be to close your first form when opening the second,
and then reopen it when closing the second using the CustomerID in the
Where clause.

(Code is called from OnClose event on your second form)

Docmd.Openform "frmFirstform", ,,"[CustomerID] = " & Me![CustomerID]

Another method may be to set the recordsource of your first form using
code when the second is closed.

Forms!frmFirstF orm.Recordsourc e = "SELECT * FROM qryMyQuery WHERE
[CustomerID ] = " & Me![CustomerID]

.... or if your first form contains all customers you can just move to
the selected customer record...

Set myRS as DAO.Recordset
Set myRS = Forms!frmFirstF orm.Recordsetcl one
myRS.FindFirst "[CustomerID] = " & Me![CustomerID]
If Not myRS.NoMatch Then
Forms!frmFirstF orm.Bookmark = myRS.Bookmark
End If
And there are many other variations...

Br@dley
Nov 13 '05 #2
DK
HTNX !
DK
"Br@dley" <n0****@4u.co m> wrote in message
news:HL******** **********@news-server.bigpond. net.au...
In news:d4******** **@ss405.t-com.hr,
DK <da***********@ coxris.hr> said:
Please can somebody help me ?

I have forms named Form 1, Form 2 etc. having fields
CustomerName,Cu stomerAddress,. ....

Id like to have button on each form ,which will open another form
named "CustomerAd d" with list of all customers in tblCustomers. After
I pick one of the customers from the list, actual form should be
closed and details of customer shall be send to fields in Form 1 or
Form2 or...


One method would be to close your first form when opening the second,
and then reopen it when closing the second using the CustomerID in the
Where clause.

(Code is called from OnClose event on your second form)

Docmd.Openform "frmFirstform", ,,"[CustomerID] = " & Me![CustomerID]

Another method may be to set the recordsource of your first form using
code when the second is closed.

Forms!frmFirstF orm.Recordsourc e = "SELECT * FROM qryMyQuery WHERE
[CustomerID ] = " & Me![CustomerID]

... or if your first form contains all customers you can just move to
the selected customer record...

Set myRS as DAO.Recordset
Set myRS = Forms!frmFirstF orm.Recordsetcl one
myRS.FindFirst "[CustomerID] = " & Me![CustomerID]
If Not myRS.NoMatch Then
Forms!frmFirstF orm.Bookmark = myRS.Bookmark
End If
And there are many other variations...

Br@dley

Nov 13 '05 #3
DK wrote:
Please can somebody help me ?

I have forms named Form 1, Form 2 etc. having fields
CustomerName,Cu stomerAddress,. ....

Id like to have button on each form ,which will open another form named
"CustomerAd d" with list of all customers in tblCustomers. After I pick one
of the customers from the list, actual form should be closed and details of
customer shall be send to fields in Form 1 or Form2 or...

Thank You

D

You could pass an argument to the the CustAdd form. Ex:
DoCmd.OpenForm "CustAdd", acNormal, , , ,acDialog,"Form 1"

CustAdd now knows which form called it. In the AfterUpdate event of
CustAdd you could do something like
If not IsNull(Me.OpenA rgs) Then
Forms(Me.OpenAr gs).CustName = Me.CustName
Forms(Me.OpenAr gs).CustAddr = Me.CustAddr
Endif

If Form1 is linked to the customer table, you could Requery the form and
then go back to the record.
Dim rst As Recordset
Dim varID As Variant
If Me.OpenArgs = "Form1" Then
varId = Forms!Form1!ID 'the record key
Forms!Form1.for m.Requery 'update the table
set rst = Forms!Form1.For m.Recordsetclon e
rst.FindFirst "ID = " & varID 'go back to record
Forms!Form1.For m.BookMark = rst.BookMark
rst.Close
Endif
Set rst = Nothing


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
10548
by: Mark | last post by:
A beginner in this area, I have been able to read a record from a MySQL database and populate an HTML form (wow!). Now, my goal is to allow the user to edit the contents of the form and then update the record in MySQL. The problem is, as soon as the "Update" button (type="submit") is pressed, all of the data disappear from the form. How can that be prevented? Here is my code:
1
8499
by: Mark Reed | last post by:
Hi All, I'm having a problem with the following code. I've read quite a lot of old posts regarding the issue but none seem to affer a solution. The scenario is. I have a bound form which contains a couple of memo fields. I need to keep some sort of log as to when each update of the memo field occurs so I have locked bot the memo fields on the main form. To edit them, the user double clicks the ememo field which then opens an unbound...
5
2593
by: Stephen Plotnick | last post by:
I'm very new to VB.NET 2003 Here is what I have accomplished: MainSelectForm - Selects an item In a public class I pass a DataViewRow to ItemInformation1 Form ItemInformation2 Form
2
2839
by: devine | last post by:
Hi All, I am trying to send an automatic email when an update has been made. My update statement will updates 6 fields, and dependant on one of the fields, I would like to send an email using CDO. Once the update is made, I am trying to re-query the database to retrieve all the fields that need to be included in the email, but it's just not working for me!! This my code to update <% Set Conn = Server.CreateObject("ADODB.Connection")...
2
2629
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to update the information which is stored in a SQL database. In testing we noticed that the form was updating correctly but the update mechanism was also updating the first record of the table in the sql database every time. No error messages are on...
0
8256
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
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,...
0
8694
Oralloy
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...
0
8635
jinu1996
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...
1
8356
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,...
1
6118
isladogs
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...
0
4089
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...
1
2621
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
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.