473,320 Members | 1,846 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,320 software developers and data experts.

Display table data in form text box

Hi,

Im pretty stuck. This is probably simple as, but I can't do it for the life
of me.

I have a form, frmRetailOrders with subform frmRetailOrderLine.

On the retailorders form, i simply want a text box to equal a "shipping"
rate, and another for the "VAT" rate. I am trying to pull these 2 values
from a table named "tblVariables", as the user needs to be able to change
them.

Any help would be appreciated.

Regards
Craig
Nov 12 '05 #1
2 6127
"Craig M" <No**@mPlz.Thx> wrote in message news:<40***********************@news-text.dial.pipex.com>...
Hi,

Im pretty stuck. This is probably simple as, but I can't do it for the life
of me.

I have a form, frmRetailOrders with subform frmRetailOrderLine.

On the retailorders form, i simply want a text box to equal a "shipping"
rate, and another for the "VAT" rate. I am trying to pull these 2 values
from a table named "tblVariables", as the user needs to be able to change
them.

Any help would be appreciated.

Regards
Craig


Note: I'm just taking a guess at what you're trying to do.
I'm assuming tblVariables has only one record and that
the same value of ShippingRate and VATRate is used for
every customer until it gets changed. If this is not the
case then you'll need to omit the save part to keep the
same default values coming up. I couldn't tell if the user
being able to change them meant changing them in
tblVariables or changing them on the form for that order.

In your sub in frmRetailOrders put...

....current Dim statements
Dim MyDB As Database
Dim VarRS As Recordset
Dim strSQL As String

Set MyDB = CurrentDb
strSQL = "SELECT * FROM tblVariables;"
Set VarRS = MyDB.OpenRecordset(strSQL, dbOpenSnapshot)
VarRS.MoveFirst
txtShippingRate.Value = VarRS("ShippingRate")
txtVATRate.Value = VarRS("VATRate")
VarRS.Close
Set VarRS = Nothing
Set MyDB = Nothing
....

To save changed values back to tblVariables, create a new
command button called cmdSaveNewRates and in its OnClick
event paste the following code:

cmdSaveNewRates_Click()
Dim MyDB As Database
Dim VarRS As Recordset
Dim strSQL As String

Set MyDB = CurrentDb
strSQL = "SELECT * FROM tblVariables;"
Set VarRS = MyDB.OpenRecordset(strSQL, dbOpenDynaset)
VarRS.MoveFirst
VarRS.Edit
VarRS("ShippingRate") = txtShippingRate.Value
VarRS("VATRate") = txtVATRate.Value
VarRS.Update
VarRS.Close
Set VarRS = Nothing
Set MyDB = Nothing
MsgBox("ShippingRate and VATRate were updated successfully.")
End Sub

Post again explaining what you need to do in more detail if this
is not what you need.

James A. Fortune
Nov 12 '05 #2
"James Fortune" <ja******@oakland.edu> wrote in message
news:a6**************************@posting.google.c om...
"Craig M" <No**@mPlz.Thx> wrote in message

news:<40***********************@news-text.dial.pipex.com>...
Hi,

Im pretty stuck. This is probably simple as, but I can't do it for the life of me.

I have a form, frmRetailOrders with subform frmRetailOrderLine.

On the retailorders form, i simply want a text box to equal a "shipping"
rate, and another for the "VAT" rate. I am trying to pull these 2 values
from a table named "tblVariables", as the user needs to be able to change them.

Any help would be appreciated.

Regards
Craig


Note: I'm just taking a guess at what you're trying to do.
I'm assuming tblVariables has only one record and that
the same value of ShippingRate and VATRate is used for
every customer until it gets changed. If this is not the
case then you'll need to omit the save part to keep the
same default values coming up. I couldn't tell if the user
being able to change them meant changing them in
tblVariables or changing them on the form for that order.

In your sub in frmRetailOrders put...

...current Dim statements
Dim MyDB As Database
Dim VarRS As Recordset
Dim strSQL As String

Set MyDB = CurrentDb
strSQL = "SELECT * FROM tblVariables;"
Set VarRS = MyDB.OpenRecordset(strSQL, dbOpenSnapshot)
VarRS.MoveFirst
txtShippingRate.Value = VarRS("ShippingRate")
txtVATRate.Value = VarRS("VATRate")
VarRS.Close
Set VarRS = Nothing
Set MyDB = Nothing
...

To save changed values back to tblVariables, create a new
command button called cmdSaveNewRates and in its OnClick
event paste the following code:

cmdSaveNewRates_Click()
Dim MyDB As Database
Dim VarRS As Recordset
Dim strSQL As String

Set MyDB = CurrentDb
strSQL = "SELECT * FROM tblVariables;"
Set VarRS = MyDB.OpenRecordset(strSQL, dbOpenDynaset)
VarRS.MoveFirst
VarRS.Edit
VarRS("ShippingRate") = txtShippingRate.Value
VarRS("VATRate") = txtVATRate.Value
VarRS.Update
VarRS.Close
Set VarRS = Nothing
Set MyDB = Nothing
MsgBox("ShippingRate and VATRate were updated successfully.")
End Sub

Post again explaining what you need to do in more detail if this
is not what you need.

James A. Fortune

That worked first time :) I had worked around it by placing another sub-form
based on tblVariables; it was a bit messy.

Thanks a ton, buddy. Great help :D

Craig
Nov 12 '05 #3

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

Similar topics

6
by: HartSA | last post by:
Here is the relevent part of my code. I am trying to learn ASP. <body> <table border="0" cellspacing="0" cellpadding="0"> <form name="frmSearch1a" method="get"> <tr> <td align=center>...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
1
by: Jon W | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"> <html> <head> <title>rolly</title> <!-- The desired performance for this gem would be to: 1. click on table cells 2. edit in INPUT 3....
3
by: Scott | last post by:
Relative newbie here, I'm looking to display the value of radio buttons and check boxes on the page before submission. So far I can do most of it. When "Hat" is checked there are to be no color...
0
by: Jon W | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"> <html> <head> <title>rolly</title> <!-- The desired performance for this gem would be to: 1. click on table cells 2. edit in INPUT 3....
3
by: matthewemiclea | last post by:
I am trying to display information in Access on a form that takes information from many different queries and puts them together on a spreadsheet or chart. Some specific info: The information I...
11
by: bala | last post by:
hi!!! i need to display a disclaimer which is two page in length in a word document. i also need to format the text. the idea is something as follows on opening the application, a form which...
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
4
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc.,...
4
ak1dnar
by: ak1dnar | last post by:
Hi, I have created a PHP page that write down form data to mySQL table. Before i submit data I want to check the Input field, whether it has filled up or Not. the form should validate from the PHP...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.