473,513 Members | 2,424 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,CustomerAddress,.....

Id like to have button on each form ,which will open another form named
"CustomerAdd" 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 1462
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,CustomerAddress,.....

Id like to have button on each form ,which will open another form
named "CustomerAdd" 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!frmFirstForm.Recordsource = "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!frmFirstForm.Recordsetclone
myRS.FindFirst "[CustomerID] = " & Me![CustomerID]
If Not myRS.NoMatch Then
Forms!frmFirstForm.Bookmark = myRS.Bookmark
End If
And there are many other variations...

Br@dley
Nov 13 '05 #2
DK
HTNX !
DK
"Br@dley" <n0****@4u.com> 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,CustomerAddress,.....

Id like to have button on each form ,which will open another form
named "CustomerAdd" 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!frmFirstForm.Recordsource = "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!frmFirstForm.Recordsetclone
myRS.FindFirst "[CustomerID] = " & Me![CustomerID]
If Not myRS.NoMatch Then
Forms!frmFirstForm.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,CustomerAddress,.....

Id like to have button on each form ,which will open another form named
"CustomerAdd" 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,"Form1"

CustAdd now knows which form called it. In the AfterUpdate event of
CustAdd you could do something like
If not IsNull(Me.OpenArgs) Then
Forms(Me.OpenArgs).CustName = Me.CustName
Forms(Me.OpenArgs).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.form.Requery 'update the table
set rst = Forms!Form1.Form.Recordsetclone
rst.FindFirst "ID = " & varID 'go back to record
Forms!Form1.Form.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
10544
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...
1
8483
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...
5
2586
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
2836
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....
2
2613
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...
0
7267
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,...
1
7120
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...
0
7542
tracyyun
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...
1
5100
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...
0
4754
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...
0
3247
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...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
466
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...

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.