473,624 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URGENT!! Problem sending data to field

Hi,

I have a combo box(cmboParts) and the row source is a part name. Once
a part is selected I have button(cmdOrder Add) to add data about this
part to a sub-form(frmParts_O rdered). However this sub-form does not
have the field PartName. Instead it has a field called PartCode.
Therefore i have had to set up a QBE to find PartCode(both PartName
and PartCode are in the same table 'tblPart') and this will be used in
the code for the button.

I have been having major problems trying out different things but they
haven't seemed to work. This is what i have so far:

Private Sub cmdOrderAdd_Cli ck()
msg = Forms!frmOrder! cmboParts
strSQL = "SELECT PartCode FROM tblPart WHERE PartName = "' & msg & "'"

Following this the QBE query has to come into use but i don't know how
to do it.

I'm sure there are some clever people who can help me!
Many thanks

James
Nov 12 '05 #1
3 1802
On 9 Apr 2004 02:44:20 -0700, ja************@ hotmail.com (James)
wrote:
Hi,

I have a combo box(cmboParts) and the row source is a part name. Once
a part is selected I have button(cmdOrder Add) to add data about this
part to a sub-form(frmParts_O rdered). However this sub-form does not
have the field PartName. Instead it has a field called PartCode.
Therefore i have had to set up a QBE to find PartCode(both PartName
and PartCode are in the same table 'tblPart') and this will be used in
the code for the button.

I have been having major problems trying out different things but they
haven't seemed to work. This is what i have so far:

Private Sub cmdOrderAdd_Cli ck()
msg = Forms!frmOrder! cmboParts
strSQL = "SELECT PartCode FROM tblPart WHERE PartName = "' & msg & "'"

Following this the QBE query has to come into use but i don't know how
to do it.

I'm sure there are some clever people who can help me!
Many thanks

James


Why not have the row source of cmboParts have both the part name and
part code. Make the widths 1";0" and then only the part name will be
displayed.

The part code corresponding to the user-selected part name will then
be cmboParts.colum n(1) (column numbering starts at 0).

Chuck
Nov 12 '05 #2
Hi James,

Being that I am a Partsperson, I am using a totally different approach ...
<Grin>

My main form contains the Supplier information from tblSuppliers, and the
subform contains the Order items from tblTransactions , sorted by TransID.
My datasheet style subform has a combo-box (yes, datasheet-style forms do
support combo-boxes) that is used to select a part number.
The Master / Child Links are by SupplierID, so I suppose that the portion of
my code below that sets this value is redundant.

Selecting the part number also fills in the corresponding description and
pricing information, which CAN be over-ridden if desired, so that all that
is left to do is to enter a TransQty!

My subform also has 2 unbound textbox controls in it's footer section that
calculate totals and counts.
These controls have the following properties:
------------------------------------------------------------------

Name: txtOrderValue
Control Source: =Sum([TransQty]*([PartCost]+[PartCore]))
Format: Currency

Name: txtItemCount
Control Source: =Count(*)
Note that while these textboxes are NOT visible in datasheet view, their
values CAN be carried forward to the main form.

My main form unbound textbox controls which are used to display these
values:
------------------------------------------------------------------
Name: txtItemCount (which is same name as the suform control)
Control Source: =[sbfPartsOrder].[Form]![txtItemCount]

Name: txtOrderValue (again, the same name as the subform control)
Control Source: =[sbfPartsOrder].[Form]![txtOrderValue]
Format: Currency
------------------------------------------------------------------

Here is the code:
=============== =============== =============== =============== ======
Private Sub cboPartNumber_A fterUpdate()
'This is the Row Source for this combo-box, which is bound to PartID
'SELECT DISTINCTROW PartID, SupplierID, Line, PartNumber, Description,
Retail, Cost, Core FROM tblPartsInvento ry;

Dim ctl As Control
Set ctl = Me.cboPartNumbe r

Dim MySupp, MyLine, MyPart, MyDesc As String
Dim MyRetl, MyCost, MyCore As Currency

With ctl
MySupp = ctl.Column(1) 'Probably don't need this. The Link Master / Child
criteria should force this value.
MyLine = ctl.Column(2)
MyPart = ctl.Column(3)
MyDesc = ctl.Column(4)
MyRetl = ctl.Column(5)
MyCost = ctl.Column(6)
MyCore = ctl.Column(7)
End With

Me.TransDate = Date
Me.TransType = "Parts Order"

Me![SupplierID] = MySupp
Me![Line] = MyLine
Me![PartNumber] = MyPart
Me![Description] = MyDesc
Me![PartRetail] = MyRetl
Me![PartCost] = MyCost
Me![PartCore] = MyCore

Me![TransQty].SetFocus

Set ctl = Nothing
End Sub
=============== =============== =============== =============== ======
Private Sub TransQty_AfterU pdate()
Me.Recalc 'Refresh all calculated controls on this form
End Sub
=============== =============== =============== =============== ======
--
HTH,
Don
=============== ==============
Use My*****@Telus.N et for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.
=============== ==============
"James" <ja************ @hotmail.com> wrote in message
news:7a******** *************** ***@posting.goo gle.com...
Hi,

I have a combo box(cmboParts) and the row source is a part name. Once
a part is selected I have button(cmdOrder Add) to add data about this
part to a sub-form(frmParts_O rdered). However this sub-form does not
have the field PartName. Instead it has a field called PartCode.
Therefore i have had to set up a QBE to find PartCode(both PartName
and PartCode are in the same table 'tblPart') and this will be used in
the code for the button.

I have been having major problems trying out different things but they
haven't seemed to work. This is what i have so far:

Private Sub cmdOrderAdd_Cli ck()
msg = Forms!frmOrder! cmboParts
strSQL = "SELECT PartCode FROM tblPart WHERE PartName = "' & msg & "'"

Following this the QBE query has to come into use but i don't know how
to do it.

I'm sure there are some clever people who can help me!
Many thanks

James

Nov 12 '05 #3
Hey Jammie:
As Chuck suggested, a multi-column combo box would come in handy.
Search the help for this. You basically just put the partscode in a
hidden column of a combo(set "Select partcode, partname from tblParts"
as the rowsource, set columncount=2, with column widths= 0", 1", and
boundcolumn = 0, that being the first column, aka partcode. this is
just a possible example).

Now, I'm not sure of this exact setup, but it sounds as though maybe
you really don't need a subform, if all this is is a 'lookup/update'
type of form. If this is true, I'd just put the lookup combo in the
form header. Don't set a recordsource in design view for the form at
all. That way you won't pull in all the parts when you open the form
- should make the form open faster. In this scenario, probably don't
want record selectors on the form, either.

Here's some basic code I just wrote and briefly tested. So, behind
your form, something like this:

Option Compare Database
Option Explicit
Private strMySQL As String
Private strWhere As String

Private Sub Form_Open(Cance l As Integer)

Me.Detail.Visib le = False
strMySQL = "Select * from [tblParts]"

End Sub

Private Sub cboParts_AfterU pdate()

strWhere = " Where [PartCode]=" & Me.PartCode
Me.RecordSource = strMySQL & strWhere

If Me.RecordsetClo ne.RecordCount > 0 Then
Me.Detail.Visib le = True
Else
Me.Detail.Visib le = False
Me.RecordSource = ""
MsgBox "No Record Returned. Try Again!"
End If

End Sub

Saves will automatically occur when you move to a new record, or close
the form...still, most users intuitively look for 'save' buttons, and
it's always nice to have an 'undo' button on forms as well...

I've whipped up a little sample database showing you how to do this
kinda thing (w/data entry mode, too ;)

shoot me an email if you'd like me to forward it to you...
hth
brett

ja************@ hotmail.com (James) wrote in message news:<7a******* *************** ****@posting.go ogle.com>...
Hi,

I have a combo box(cmboParts) and the row source is a part name. Once
a part is selected I have button(cmdOrder Add) to add data about this
part to a sub-form(frmParts_O rdered). However this sub-form does not
have the field PartName. Instead it has a field called PartCode.
Therefore i have had to set up a QBE to find PartCode(both PartName
and PartCode are in the same table 'tblPart') and this will be used in
the code for the button.

I have been having major problems trying out different things but they
haven't seemed to work. This is what i have so far:

Private Sub cmdOrderAdd_Cli ck()
msg = Forms!frmOrder! cmboParts
strSQL = "SELECT PartCode FROM tblPart WHERE PartName = "' & msg & "'"

Following this the QBE query has to come into use but i don't know how
to do it.

I'm sure there are some clever people who can help me!
Many thanks

James

Nov 12 '05 #4

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

Similar topics

2
3506
by: UrgeOverkill | last post by:
I'm having a problem sending data from a socket server. The server side reports that it has sent 4845 bytes but the client reports only 1448 bytes received. The kicker is that this ONLY happens accross the internet... I've tested this with multiple connections. If I run the same server and client, connect them locally I don't have a problem with byte totals. Is there a timeout that I need to set... I've looked at and change several...
1
3786
by: Daniel | last post by:
after opening socket, sending data then closing socket 3000 times i get "Only one usage of each socket address" what am i doing wrong? is there some thing else i need to do to free up the socket after i send data into it? I simply want to open socket, send data, close socket and have the server just handle one client thread to recieve connection, recieve data, and close socket
4
3568
by: David | last post by:
I'm wondering if python is capable of fairly precise timing and also sending data out the parallel port. For example ; making a 7.5 KHz square wave come out of one of the data pins on the printer port. I've tried to help myself with this one but searching in the "Python Library Reference" that installed with my version, yielded nothing on the subject of either timing or parallel port.
1
1955
by: ccr | last post by:
Please view in a text editor so that the columnar text lines up. I used Terminal 9pt font to compose this post and copied/pasted to my newsreader program. I am writing in the hope that one of you Visual Basic experts may provide a solution, or at least some insight, to the problem described below. I am not a programmer, but am fairly knowledgeable about computers. If necessary, I could flowchart a process to do what needs to be done....
4
8196
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with TcpClient, NetworkStream and StreamWriter classes. but with low level socket it doesn't work (When using the Socket class Send method).
0
1785
by: vladimir.plotnikov | last post by:
Hello! I have problem: I have IPB forum installed. After search in IPB (search takes about 3-4 seconds for post table about 300 000 records) mysql shows "Sending Data" status and takes about 3-5 minutes. I tested with PHP 5.2, PHP 4.4, PHP 4.2.3 - with same results. I switched from MySQL 4.2.18 to 4.2.21 and 4.2.22 with same result.
1
1661
by: Charlie | last post by:
Hi: I need a way to test my TcpListner, but not sure what applications are sending data to tcp ports. How about Email or Instant Messenger? If they are tcp, what ports are they sending data to? Any other suggestions? Also, what port do Http responses target on client machine before being rendered in browser? Thanks,
5
1822
by: Navin Mishra | last post by:
Hi, In load test of our .NET 2.0 socket application on Win2003 server, we are seeing sometimes WSEWOULDBLOCK error when sending data to clients. We are using synchronoous scokets with SendTimout of 2 secs. Is it normal ? Thanks in advance and regards Navin
3
6629
by: Mateo | last post by:
(As.Net 1.1 framework!) Hi! So, I have problem as described in subject. Here is source code:
1
1705
by: markla | last post by:
Hi, Can someone help me understand why for the code below, when added as a "FieldTemplate" in Dynamic Data, and rendered for a field, does not trigger the "test" function and hence update the label control? (CodeBehind is pretty much same as the original shipped ForeignKey_Edit code, and an event in the codeBehind does not get fired either)
0
8246
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
8179
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
8685
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...
1
8341
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,...
0
8490
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 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...
0
5570
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();...
0
4084
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
2612
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
1
1796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.