Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Forms

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-07-2010, 05:47 PM
ngeng4 ngeng4 is offline Windows XP Access 2003 (version 11.0)
Advanced Beginner
 
Join Date: Mar 2010
Posts: 93
ngeng4 is on a distinguished road
Default problem with the updating form

hello all,
i have 2 form in my db. 1st - use to add new data. means the blank form
2nd - use to update or edit the data.

ive successfully create the 1st form with the blank form onActive.

but im failed to create the 2nd form. even theres a data in a table, still the data does not appear in a 2nd form. why?
Reply With Quote
  #2  
Old 03-07-2010, 06:09 PM
pbaldy's Avatar
pbaldy pbaldy is online now Windows XP Access 2007 (version 12.0)
Who is John Galt?
 
Join Date: Feb 2010
Location: Nevada, USA
Posts: 1,223
pbaldy is on a distinguished road
Default

How many different places did you post this?

Make sure the Data Entry property of the form is No. Personally, I would use one form and open it in one mode or the other.
__________________
Paul
MS Access MVP
www.BaldyWeb.com
Reply With Quote
  #3  
Old 03-07-2010, 06:45 PM
ngeng4 ngeng4 is offline Windows XP Access 2003 (version 11.0)
Advanced Beginner
 
Join Date: Mar 2010
Posts: 93
ngeng4 is on a distinguished road
Default

hehehe. i posted this on 3 different forum. ok i have tried ur suggestion but didnt work
Reply With Quote
  #4  
Old 03-07-2010, 06:47 PM
ngeng4 ngeng4 is offline Windows XP Access 2003 (version 11.0)
Advanced Beginner
 
Join Date: Mar 2010
Posts: 93
ngeng4 is on a distinguished road
Default

if i use only 1 form, then i need to have 2 command button right? for updating and editing. then i know bout the coding for the updating which is for the blank form. but i dont know the coding for the editing.
Reply With Quote
  #5  
Old 03-07-2010, 07:49 PM
pbaldy's Avatar
pbaldy pbaldy is online now Windows XP Access 2007 (version 12.0)
Who is John Galt?
 
Join Date: Feb 2010
Location: Nevada, USA
Posts: 1,223
pbaldy is on a distinguished road
Default

The datamode argument of OpenForm would dictate how the form is opened. If the form was bound to the table, using the appropriate argument would open it blank for data entry or displaying existing records.
__________________
Paul
MS Access MVP
www.BaldyWeb.com
Reply With Quote
  #6  
Old 03-07-2010, 09:21 PM
ngeng4 ngeng4 is offline Windows XP Access 2003 (version 11.0)
Advanced Beginner
 
Join Date: Mar 2010
Posts: 93
ngeng4 is on a distinguished road
Default

cant understand..=(..can u xplain it?
Reply With Quote
  #7  
Old 03-07-2010, 09:43 PM
pbaldy's Avatar
pbaldy pbaldy is online now Windows XP Access 2007 (version 12.0)
Who is John Galt?
 
Join Date: Feb 2010
Location: Nevada, USA
Posts: 1,223
pbaldy is on a distinguished road
Default

Start by looking in VBA help on OpenForm, specifically at the DataMode argument.
__________________
Paul
MS Access MVP
www.BaldyWeb.com
Reply With Quote
  #8  
Old 03-07-2010, 09:44 PM
maximus's Avatar
maximus maximus is online now Windows 7 Access 2010 (version 14.0)
Wizard
 
Join Date: Aug 2009
Location: India
Posts: 712
Blog Entries: 1
maximus is on a distinguished road
Default

Let me get you straight you have two forms one which is meant for data entry always opens blank and the other you intend to use should open with data in it. Now my question are you trying to open the second form from another form based on some criteria? anyways you can try out the following.

Open the second form in design view and go to Form properties and check Whether Data Entry is set to No, if it is Yes make it no.

Now if you are opening you form from another fForm using say a CommandButton then you will have a code similar to one below in the OnClick event of the CommandButton

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Main21"

stLinkCriteria = "[FraudRef]=" & Me![FraudRef]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd


Check the portion marked in Red if it is acFormAdd then change it to acFormEdit.

This should solve your problem. if it does please mark this thread solved.
Reply With Quote
  #9  
Old 03-07-2010, 09:49 PM
ngeng4 ngeng4 is offline Windows XP Access 2003 (version 11.0)
Advanced Beginner
 
Join Date: Mar 2010
Posts: 93
ngeng4 is on a distinguished road
Default

it have 2 command button for each form to open it. 1 for the updating and another is for editing. the editing form shud be open with a data in it.
Reply With Quote
  #10  
Old 03-07-2010, 10:08 PM
maximus's Avatar
maximus maximus is online now Windows 7 Access 2010 (version 14.0)
Wizard
 
Join Date: Aug 2009
Location: India
Posts: 712
Blog Entries: 1
maximus is on a distinguished road
Default

So basically you want to open the same form in different data modes right. Follow the the example code change the part marked in red to acFormEdit.
Reply With Quote
  #11  
Old 03-07-2010, 10:25 PM
ngeng4 ngeng4 is offline Windows XP Access 2003 (version 11.0)
Advanced Beginner
 
Join Date: Mar 2010
Posts: 93
ngeng4 is on a distinguished road
Default

ive followed what did u said then get the error, for the "[FraudRef]=
Reply With Quote
  #12  
Old 03-07-2010, 11:22 PM
maximus's Avatar
maximus maximus is online now Windows 7 Access 2010 (version 14.0)
Wizard
 
Join Date: Aug 2009
Location: India
Posts: 712
Blog Entries: 1
maximus is on a distinguished road
Default

Well this is an example and you nee to add the names of the fields in your form.

The example here opens a form called Main21 and displays a record whose FraudRef is = to the FraudRef of a record on a Form called Main Form.


Now here is what you need to do

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Name of the Form you want to open"

stLinkCriteria = "[Name of the Field in the form you want to open]=" & Me![Name of the Field from which you want to open another form]
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit

you got this error because you don't have the field name FraudRef do you ha!ha!

feel free to ask if you have any more problems.
Reply With Quote
  #13  
Old 03-07-2010, 11:24 PM
ngeng4 ngeng4 is offline Windows XP Access 2003 (version 11.0)
Advanced Beginner
 
Join Date: Mar 2010
Posts: 93
ngeng4 is on a distinguished road
Default

hahahha..shame on me.. i got a lot of problem with this lor.....between, thank you very muchhh
Reply With Quote
  #14  
Old 03-07-2010, 11:29 PM
ngeng4 ngeng4 is offline Windows XP Access 2003 (version 11.0)
Advanced Beginner
 
Join Date: Mar 2010
Posts: 93
ngeng4 is on a distinguished road
Default

and i also receive this message whenever i tried to add new data to my db by using the form
Attached Files
File Type: zip error.zip (80.5 KB, 4 views)
Reply With Quote
  #15  
Old 03-07-2010, 11:58 PM
maximus's Avatar
maximus maximus is online now Windows 7 Access 2010 (version 14.0)
Wizard
 
Join Date: Aug 2009
Location: India
Posts: 712
Blog Entries: 1
maximus is on a distinguished road
Default

Let me guess you are very new to access right.

Never mind don't be dissapointed we are all learning:

Case 1:

When you want to open a form using a command Button to enter data that means it will be blank!!!

Name of the Form Main

The following will be the code:

Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Main" 'Name of the form you want to open
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd 'acFormAdd ensures that the form is opened blank

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click

End Sub

Case 2:

When you want to open a form using a command Button to see all the data in the form


Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Main" 'Name of the form you want to open
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit 'acFormEdit ensures that the form is opened with all the records

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click

End Sub


Case 3:

This is Opening a Form from another Form base on some Criteria. I will use the Code that I had posted for your easy understanding:
I have two Forms: Main and Main 21

I have a Field FraudRef on Both Main and Main21

Now I want to Open Form Main21 From Form Main to Display a Record Where the FraudRef in both the Forms are same.
e.g. FraudRef in Main = FraudRef in Main21

Private Sub Command13_Click()
On Error GoTo Err_Command13_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Main21" 'Name of the Form I want to open

stLinkCriteria = "[FraudRef]=" & Me![FraudRef] 'I have set the criteria where Main21 for will open and display a record
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd 'Whose FraudRef = FraudRef on Form Main

Exit_Command13_Click:
Exit Sub

Err_Command13_Click:
MsgBox Err.Description
Resume Exit_Command13_Click

End Sub

Three cases are there decide which one you require.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem updating from within a query. Frank Nye Queries 5 10-14-2009 08:33 AM
new problem: Updating Combo box ali-gagi Forms 4 07-06-2009 05:29 PM
combo not updating form cjamps Forms 5 04-14-2009 10:00 AM
Updating Table field from Form Kunuk Access 0 02-26-2009 08:41 PM
Updating SQL server form Access form? slash75 Forms 1 09-06-2008 12:39 PM


All times are GMT -8. The time now is 08:20 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.