473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Populate control in another form

My task is to place a button in the form clients,with which to open
the form Customers, go to a new record, and populate this new customer
with the data from the client. This client should be then deleted,
since he is becoming customer already.

With the following code i open the new form,go to a new record, but then
the data are not transferred :
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FCustomers"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , "", acNewRec
DoCmd.GoToControl "customerid"
Dim f As Form
Set f = Forms![FCustomers]
f![CompanyName] = Me![CompanyName]
f![City] = Me![city]
f![phone] = Me![phone]
RunCommand acCmdDeleteRecord
Nov 12 '05 #1
1 3358
What _does_ happen? Error messages?

It seems likely that you are trying to work with that form before it
actually opens. I'd suggest you open the form in Data Entry mode and in the
Load, or OnCurrent events of the newly-opened form, obtain the data from the
still-open Client form. Once you have the information, then you can close
the Client form.

As to deleting the Client record, you can do that with a Query from VBA
code -- the Client form does not have to be open.

Larry Linson
Microsoft Access MVP
"Jim Stacey" <og********@yahoo.com> wrote in message
news:9c**************************@posting.google.c om...
My task is to place a button in the form clients,with which to open
the form Customers, go to a new record, and populate this new customer
with the data from the client. This client should be then deleted,
since he is becoming customer already.

With the following code i open the new form,go to a new record, but then
the data are not transferred :
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FCustomers"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , "", acNewRec
DoCmd.GoToControl "customerid"
Dim f As Form
Set f = Forms![FCustomers]
f![CompanyName] = Me![CompanyName]
f![City] = Me![city]
f![phone] = Me![phone]
RunCommand acCmdDeleteRecord

Nov 12 '05 #2

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

Similar topics

1
by: John Phelan-Cummings | last post by:
I'm not certain if this made the post. Sorry if it's a repeat: Using a Button to take an autonumber from one form to populate another autonumber field on another form. I have a Mainform "A"...
2
by: MattB | last post by:
I've got a web form (asp.net 1.1, vb.net) that has controls for a user to enter their height and weight in either English or Metric units. I'd like to be able to populate the metric control when...
3
by: Sampson | last post by:
I have a question about enumeration and how to populate them during runtime. I am using vb.net but will happily take any advice in c# as well. Here is an example to help illustrate what I am...
2
by: Dave Wurtz | last post by:
All, I have a treeview on my form that has a lot of nodes on it. I would like to populate this treeview on another thread so my form will still paint while it is being populated. I have...
5
by: Arpan | last post by:
In order to populate any server control with data dynamically, is it ALWAYS NECESSARY to either BIND the DataSource to that server control or call the DataBind method of that server control? For...
2
by: rn5a | last post by:
This function in a VB class file takes UserID as a parameter & returns a SqlDataReader to the calling function which exists in a ASPX page: Namespace NConnect Public Class Cart Private sqlConn...
10
by: Paul E Collins | last post by:
I want to fill an ImageList with bitmaps for a ListView from another thread, because it's a time-consuming process. I expect the ListViewItems' images to "load" one by one, as in a Web browser. ...
4
by: brad | last post by:
Hi there, New to javascript. Question about populating a form on a webpage that I do not control. I can see the field names and ids and currently have a button that onsubmit opens the page in a...
1
by: KMEscherich | last post by:
Platform = Windows Program = Access 2003 Hi there, I am stumpped!! I am attempting to populate a form control as follows: I have a form that has 2 drop-down boxes. One retrieves the...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
0
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...
0
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,...
0
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...
0
agi2029
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,...

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.