I have a data entry form called Draw. This form is used to enter data
in the table called Draw. The table has the following fields:
WholesalerID, MagID, IssueID, CopiesDist, and the index is called
DrawIndex. The DrawIndex is a combination autonumber index that uses
the
combination of these three fields WholesalerID, MagID, IssueID to
ensure that each record is unique.
When a used tries to enter data that has a the same WholesalerID,
MagID, IssueID combination as an existing record, I set it up so that
that error triggers a yes/no box. I'd like the user to have the
option to edit the existing record in the table. I want another form
called EditDrawForm to open so they can modify the existing record if
they choose to do so.
How do I pass the existing record to the new form?
Here's my script so far. Any help would be greatly appreciated.
Someone suggested OpenArgs, but I'm not sure how to use that here...
Option Compare Database
Private Sub ButtonAddDraw_Click()
On Error GoTo Err_ButtonAddDraw_Click
DoCmd.GoToRecord , , acNewRec
Exit_ButtonAddDraw_Click:
Exit Sub
Err_ButtonAddDraw_Click:
Select Case Err.Number
Case 2105
Err.Clear
'* Display my custom message box
If MsgBox("The draw has already been entered for this issue.
Would you like to edit it?", vbYesNo) = vbYes Then
DoCmd.OpenForm "MyForm"
Else
End If
GoTo Exit_ButtonAddDraw_Click
Case Else
MsgBox Err.Description
End Select
Resume Exit_ButtonAddDraw_Click
End Sub
I guess one of my questions is that when the user inputs the info in
the first form and the form checks the table and finds that a record
already exists and triggers the error does that make that record have
the focus?
That's where I'm kind of stuck. I don't know if it's best to open an
editing ofrm with the existing record using openform and openargs (and
I'm not sure how to do this even after having read the help on
openargs) or is it best to use a query to pop up the editing form.
The thing I'm having trouble with is how to pass the record between
the forms.
Don 3 5160
Look at the WhereCondition argument of DoCmd.OpenForm.
But also consider the option of using the Form you have displayed by
locating to the existing record (how you'd do this will depend on the Form's
RecordSource... it may be as simple as finding the record in the
Recordsetclone, which I suspect you have already done, and resetting the
Form's Bookmark property from the Recordsetclone's Bookmark property, then
changing the AllowEdits property.
Larry Linson
Microsoft Access MVP
"Don Seckler" <dj*******@hotmail.com> wrote in message
news:fe**************************@posting.google.c om... I have a data entry form called Draw. This form is used to enter data in the table called Draw. The table has the following fields: WholesalerID, MagID, IssueID, CopiesDist, and the index is called DrawIndex. The DrawIndex is a combination autonumber index that uses the combination of these three fields WholesalerID, MagID, IssueID to ensure that each record is unique.
When a used tries to enter data that has a the same WholesalerID, MagID, IssueID combination as an existing record, I set it up so that that error triggers a yes/no box. I'd like the user to have the option to edit the existing record in the table. I want another form called EditDrawForm to open so they can modify the existing record if they choose to do so.
How do I pass the existing record to the new form?
Here's my script so far. Any help would be greatly appreciated. Someone suggested OpenArgs, but I'm not sure how to use that here...
Option Compare Database
Private Sub ButtonAddDraw_Click() On Error GoTo Err_ButtonAddDraw_Click
DoCmd.GoToRecord , , acNewRec
Exit_ButtonAddDraw_Click: Exit Sub
Err_ButtonAddDraw_Click: Select Case Err.Number Case 2105 Err.Clear '* Display my custom message box If MsgBox("The draw has already been entered for this issue. Would you like to edit it?", vbYesNo) = vbYes Then DoCmd.OpenForm "MyForm" Else End If GoTo Exit_ButtonAddDraw_Click Case Else MsgBox Err.Description End Select Resume Exit_ButtonAddDraw_Click End Sub
I guess one of my questions is that when the user inputs the info in the first form and the form checks the table and finds that a record already exists and triggers the error does that make that record have the focus?
That's where I'm kind of stuck. I don't know if it's best to open an editing ofrm with the existing record using openform and openargs (and I'm not sure how to do this even after having read the help on openargs) or is it best to use a query to pop up the editing form.
The thing I'm having trouble with is how to pass the record between the forms.
Don
> How do I pass the existing record to the new form?
One of the parameters of the DoCmd.OpenForm command is a filter. You
just pass a valid WHERE clause to it. The wizard pretty much builds
everything for you...
Private Sub cmdOpenForm_Click()
On Error GoTo Err_cmdOpenForm_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Staff"
stLinkCriteria = "[StaffName]=" & "'" & Me![FirstName] & "'"
'----Following is the line you want...
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenForm_Click:
Exit Sub
Err_cmdOpenForm_Click:
MsgBox Err.Description
Resume Exit_cmdOpenForm_Click
End Sub
"Don Seckler" <dj*******@hotmail.com> wrote in message
news:fe**************************@posting.google.c om... I have a data entry form called Draw. This form is used to enter data in the table called Draw. The table has the following fields: WholesalerID, MagID, IssueID, CopiesDist, and the index is called DrawIndex. The DrawIndex is a combination autonumber index that uses the combination of these three fields WholesalerID, MagID, IssueID to ensure that each record is unique.
When a used tries to enter data that has a the same WholesalerID, MagID, IssueID combination as an existing record, I set it up so that that error triggers a yes/no box. I'd like the user to have the option to edit the existing record in the table. I want another form called EditDrawForm to open so they can modify the existing record if they choose to do so.
How do I pass the existing record to the new form?
Here's my script so far. Any help would be greatly appreciated. Someone suggested OpenArgs, but I'm not sure how to use that here...
Option Compare Database
Private Sub ButtonAddDraw_Click() On Error GoTo Err_ButtonAddDraw_Click
DoCmd.GoToRecord , , acNewRec
Exit_ButtonAddDraw_Click: Exit Sub
Err_ButtonAddDraw_Click: Select Case Err.Number Case 2105 Err.Clear '* Display my custom message box If MsgBox("The draw has already been entered for this issue. Would you like to edit it?", vbYesNo) = vbYes Then DoCmd.OpenForm "MyForm" Else End If GoTo Exit_ButtonAddDraw_Click Case Else MsgBox Err.Description End Select Resume Exit_ButtonAddDraw_Click End Sub
I guess one of my questions is that when the user inputs the info in the first form and the form checks the table and finds that a record already exists and triggers the error does that make that record have the focus?
That's where I'm kind of stuck. I don't know if it's best to open an editing ofrm with the existing record using openform and openargs (and I'm not sure how to do this even after having read the help on openargs) or is it best to use a query to pop up the editing form.
The thing I'm having trouble with is how to pass the record between the forms.
Don
Best place to get answers is at the official MVP site: http://mvp.org
Carlo Patel (MVP) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Deano |
last post by:
Thanks for the replies to my previous post. So while I'm on a roll
here's another plea for help.
I simply need the code for a button on the main form that will create a
new record in the...
|
by: Nawab |
last post by:
I need to lock a record after a user clicks on a button on my form.
Does anyone have any idea how to do this. I tried to create a command
button on my form which uses a vb procedure but cannot...
|
by: Jordan Marton |
last post by:
Two questions here.
1) Is it possible to make a vertically setup datagrid. Basically, i am
populating the grid with only information from one record, and I want it to
list downwards as opposed...
|
by: Jenny |
last post by:
Hi all
How can the following problem be solved:
My application uses forms authentication. Normally a
start.aspx page should be send to the client before
login.aspx is shown.
Start.aspx...
|
by: Hei |
last post by:
hi,
how to pass data cross form? my situation: webFormA for input data, after
submit, show webFormB to display report use crystalreport. i just need pass
record id for set...
|
by: Justin |
last post by:
I am trying to password protect a subdirectory using forms authentication. I
am using the "Location" tag to specify the directory to be protected. The
login.aspx page is in the root directory of...
|
by: mafandon |
last post by:
I am running a report based on parameters from a form. The parameters are
between two dates (ie: 1/1/2006 to 1/31/2006). However, I can choose
different dates, obviously.
My report gets all...
|
by: John |
last post by:
Hi
I need to block user from moving away from a record using any of
First/Last/Prev/Next/New Record or any other way IF the record has not been
saved, and displaying a message to the effect...
|
by: river |
last post by:
I need to be able to pass the record count of my recordset to another function. The function will perform a task only if the current record is (.AbsolutePosition + 1) = rs1.RecordCount.
Is there a...
|
by: chintan85 |
last post by:
Hi guys,
I want to pass multiple forms to different scripts. Lets say. Can u please help me..
<form action="pass1.py" method="post" name="Submit">
<input name="gene" type="checkbox"...
|
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: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
| |