Evening all,
I'm very new to VBA and am struggling badly with this one. I'll explain what I need to do as the title is a little unclear!
I'm making an insurance calculator for classic cars, and on my welcome screen I have a button called lablled Edit Existing Quote. What I would like this button to do is, upon clicking, ask the user to enter the Reg Number (the PK in my client data table) of the client whos details they wish to edit. Once a reg number is entered and submit or something has been clicked I want that record to then appear in form view.
I've got as far as the:
DoCmd.OpenForm "frm_New_Quote", acNormal
(The form is named so because I use it to add new data as well, using the 'DoCmd.GoToRecord , , acNewRec' code, the form otherwise shows client data for the last record entered.)
I'm guessing it'll involve vbQuestion somewhere in there, or possibly some SQl...I'm really not sure. I only have a very basic knowledge of VBA and the two lines I've pasted there are about all I know! I'm staring at my VBA book but failing to find the relevant pages.
So, can anyone help me out with this one? It should run like :
Click 'Edit' button on welcome screen, then little box pops up asking for reg number, then that clients details is presented.
Please help!
P.S
my client data table is called 'Client Tbl' at the moment.
3 1506
Well, a general overview would be:
Base your frm_New_Qoute on a query that includes as it's WHERE criteria the text/combo/list box that you are using to enter the Reg Number. In the query builder/design view just enter the qualified name of the text box. Qualified means like this: Forms![Form name].[Control name]
Then when you click OK and the form opens, it automatically queries it's underlying data source, which in this case is the query that you created with the WHERE criteria pointing to the text box. Obviously this pop-up form needs to be open for it's values to be registered, which means that you will include the command to close that form in a later event of your frm_New_Quote.
Anything you don't understand, just ask!
Regards,
Scott
Hey thanks for the reply! That stuff really really wants to make sense in my brain but it can't quite stick itsself into code for me.
I'm confused as to how you go about doing this, having the system ask for a variable which then calls up the relevant data. I can make the input dialogue box using code from the help files: - Dim Message, Title, Default, MyValue
-
Message = "Enter a value between 1 and 3" ' Set prompt.
-
Title = "InputBox Demo" ' Set title.
-
Default = "1" ' Set default.
-
' Display message, title, and default value.
-
MyValue = InputBox(Message, Title, Default)
-
-
' Use Helpfile and context.
-
' The Help button is added automatically.
-
MyValue = InputBox(Message, Title, , , , "DEMO.HLP", 10)
-
-
' Display dialog box at position 100, 100.
-
MyValue = InputBox(Message, Title, Default, 100, 100)
-
-
End Sub
Would I use that as part of a larger procedure to then use the data inputted and do something with it? Or would I add to that code itself?
Currently if you click OK on the produced dialogue box it just reopens itself, and I don't ahve a clue how to make it do something more useful.
Sorry to be so noobish, but a little more assistance would be greatly appriciated.
Thanks,
_Ed
Hi Ed,
No need to apologize for 'noobism' :-) On the Scripts we like to think of ourselves as 'Experts helping Experts', but the reality is more like experts helping noob's become experts.
As far as what you are attempting, it's probably going to be much much easier to create your own pop up form. Place a text box on it. Then in the query that I referred to in my first reply post, refer to this text box. The following is a query copied directly from one of my databases: -
SELECT tblCrew.*, tblConvInformation.ConventionName
-
FROM tblConvInformation INNER JOIN tblCrew ON tblConvInformation.ConvID = tblCrew.ConvID
-
WHERE (((tblCrew.ConvID)=[Forms].[frmConvInformation].[txtConvID]))
-
ORDER BY tblCrew.CrewPosition DESC;
You will notice particularly the WHERE clause and it's syntax. Once you have your query and form created, we can take a look at what more you will need to do.
Regards,
Scott
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Pete |
last post by:
Before I get started with the question, does anyone have a (single)
good book recommendation for database design? Not an Access-specific
book, but something geared toward helping me figure out...
|
by: N. Graves |
last post by:
Hi,
I want to have a Search Dialog box that has several text box and
fields to build a search and display the results in a form. I can do
everything that I need to if I us a report but I would...
|
by: Greg |
last post by:
On my report I want to have an opening balance signifying all transactions
up to the month selected
and detailed transactions for the month selected
and then a closing blance.
I'm perpelexed...
|
by: Ian |
last post by:
I want to open a form at a particular record, but I think I'm running
into problems because the recordsource query is executing
asynchronously.
In the form's open event I use...
|
by: Andy Davis |
last post by:
I have set up a mail merge document in Word 2003 which gets its data from my
Access 2000 database. I want to set up a button on a form that:
1. runs the query to provide the dat for the merge...
|
by: Colin Halliday |
last post by:
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge.
If I open this doc using the Word GUI, it first asks me to...
|
by: MartinR |
last post by:
Hi,
I'm still new to writing code in vba as I've only been introduced to
access three weeks ago. I have written this code below and it executes
but does not do what I want it to do. What I want is...
|
by: hoofbeats95 |
last post by:
I don't think this should be this complicated, but I can't figure it
out. I've worked with C# for several years now, but in a web
environment, not with windows form. I have a form with a query...
|
by: martin DH |
last post by:
**Urgent Need**
I'll throw out the basics and any assistance is very, very, very much appreciated!
Access 2003 on XP
On a form (frmMain) is an option group of check boxes (ReportFrame) from...
|
by: Phil Stanton |
last post by:
I have a form with a button which is supposed to open an Excel file (With
lots of Macros /VBA) in it. The Excel file gets it's data from the Access
program
Here is the code
Private Sub...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
| |