Welcome to dbFreaks.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

New record with data from other form

 
   Database Help (Home) -> Visual Basic RSS
Related Topics:
Open form to add record with fielddata from an open form - How do I open a form to add a record and get the data for 1 field from a specific field in a open form. I have used the following code ; Private Sub As Integer) If Then = _ ..

DAO 3.6 record locking - Hello, I want to lock users' password records after they log on to a VB6 I want to be able to determine who is logged on to the database by polling each password record to see if it is locked or not. (DBF files allowed this sort of ..

Can I Update entire record in SQL ? - Heya, I am working on making a SQL database an exact mirror of a local Access database. I check the .mdb database every few minutes for new entries, if there are new entries, I retrieve them and write them to an exact replica table in SQL. This all works

Filtering records using textbox on form - Can I use the value of a bound textbox on an open form, as a criteria in a query. If so what would be the correct code for the SQL. If not how can I hold the required value (number) that is selected by the user from a combo box at startup, so that I can..

Retrieving data from a MSHFlexGrid - I've managed to set up an and store it with data from an Access DB What I'm trying to do is retrieve data from a selected row but I'm not sure what methods I need to call to get this data. Can anyone tell me how to do this or..
Next:  Multi dimensional array  
Author Message
proo

External


Since: Feb 15, 2005
Posts: 2



(Msg. 1) Posted: Tue Feb 15, 2005 11:12 am
Post subject: New record with data from other form
Archived from groups: comp>lang>basic>visual>database (more info?)

I would like to open a addrecord form. In this form I would like teh Field
DebNr to be filled with the value of the field DebNr in my (open) form
FrmStam.

I used the VisualBasic code ;

Private Sub Form_Open(Cancel As Integer)

If IsOpen("FrmStam") Then
DebNr.DefaultValue = _
Forms!FrmStam!DebNr
End If

End Sub

After running this code the value of the field DebNr in the Addrecord form
is [#Naam?] . In Englisch [#Name?]

Where do I go wrong ?

 >> Stay informed about: New record with data from other form 
Back to top
Login to vote
Michael B. Johnson

External


Since: May 14, 2004
Posts: 16



(Msg. 2) Posted: Tue Feb 15, 2005 11:12 am
Post subject: Re: New record with data from other form - ControlSource.bmp [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 15 Feb 2005 14:46:29 +0100, "proo" <patrick RemoveThis @industrienet.nl>
wrote:

 >I would like to open a addrecord form. In this form I would like teh Field
 >DebNr to be filled with the value of the field DebNr in my (open) form
 >FrmStam.
 >
 >I used the VisualBasic code ;
 >
 >Private Sub Form_Open(Cancel As Integer)
 >
 > If IsOpen("FrmStam") Then
 > DebNr.DefaultValue = _
 > Forms!FrmStam!DebNr
 > End If
 >
 >End Sub
 >
 >After running this code the value of the field DebNr in the Addrecord form
 >is [#Naam?] . In Englisch [#Name?]
 >
 >Where do I go wrong ?

Apparently, MS Access cannot find a field named "DebNr" in the
Forms!FrmStam form.

If the field is already bound, if it already has a "Control Source",
then the code should be unnecessary. Right click on it, select
properties. Click on the Data tab. (See attached screenshot in English
MS Access '97.)

What version of MS Access are you using?
_______________________
Michael B. Johnson<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: New record with data from other form 
Back to top
Login to vote
Michael B. Johnson

External


Since: May 14, 2004
Posts: 16



(Msg. 3) Posted: Tue Feb 15, 2005 11:12 am
Post subject: Re: New record with data from other form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 15 Feb 2005 14:46:29 +0100, "proo" <patrick.DeleteThis@industrienet.nl>
wrote:

 >I would like to open a addrecord form. In this form I would like teh Field
 >DebNr to be filled with the value of the field DebNr in my (open) form
 >FrmStam.
 >
 >I used the VisualBasic code ;
 >
 >Private Sub Form_Open(Cancel As Integer)
 >
 > If IsOpen("FrmStam") Then
 > DebNr.DefaultValue = _
 > Forms!FrmStam!DebNr
 > End If
 >
 >End Sub
 >
 >After running this code the value of the field DebNr in the Addrecord form
 >is [#Naam?] . In Englisch [#Name?]
 >
 >Where do I go wrong ?

Apparently, MS Access cannot find a field named "DebNr" in the
Forms!FrmStam form.

If the field is already bound, if it already has a "Control Source",
then the code should be unnecessary. Right click on it, select
properties. Click on the Data tab. (I created a screenshot in English
MS Access '97, but binary attachments aren't allowed on my server.)

What version of MS Access are you using?
_______________________
Michael B. Johnson<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: New record with data from other form 
Back to top
Login to vote
Randy Day

External


Since: Oct 06, 2003
Posts: 50



(Msg. 4) Posted: Tue Feb 15, 2005 11:12 am
Post subject: Re: New record with data from other form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

proo wrote:

 > I would like to open a addrecord form. In this form I would like teh Field
 > DebNr to be filled with the value of the field DebNr in my (open) form
 > FrmStam.
 >
 > I used the VisualBasic code ;
 >
 > Private Sub Form_Open(Cancel As Integer)
 >
 > If IsOpen("FrmStam") Then
 > DebNr.DefaultValue = _
 > Forms!FrmStam!DebNr
 > End If
 >
 > End Sub
 >
 > After running this code the value of the field DebNr in the Addrecord form
 > is [#Naam?] . In Englisch [#Name?]
 >
 > Where do I go wrong ?

Set a breakpoint (F9) on the 'debnr.defaultvalue' line.

Run the program. When the program pauses at the
breakpoint, put the mouse pointer over
'Forms!FrmStam!DebNr'. A tooltip should pop up with
the current value in 'Forms!FrmStam!DebNr'.

Is DebNr the name of a label instead of the intended
textbox, by any chance?<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: New record with data from other form 
Back to top
Login to vote
proo

External


Since: Feb 15, 2005
Posts: 2



(Msg. 5) Posted: Tue Feb 15, 2005 2:40 pm
Post subject: Re: New record with data from other form [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Randy Day" <ruthal RemoveThis @sasktel.nex> schreef in bericht
news:11146l1nvhp0td2@corp.supernews.com...
 > proo wrote:
 >
  >> I would like to open a addrecord form. In this form I would like teh
  >> Field DebNr to be filled with the value of the field DebNr in my (open)
  >> form FrmStam.
  >>
  >> I used the VisualBasic code ;
  >>
  >> Private Sub Form_Open(Cancel As Integer)
  >>
  >> If IsOpen("FrmStam") Then
  >> DebNr.DefaultValue = _
  >> Forms!FrmStam!DebNr
  >> End If
  >>
  >> End Sub
  >>
  >> After running this code the value of the field DebNr in the Addrecord
  >> form is [#Naam?] . In Englisch [#Name?]
  >>
  >> Where do I go wrong ?
 >
 > Set a breakpoint (F9) on the 'debnr.defaultvalue' line.
 >
 > Run the program. When the program pauses at the
 > breakpoint, put the mouse pointer over
 > 'Forms!FrmStam!DebNr'. A tooltip should pop up with
 > the current value in 'Forms!FrmStam!DebNr'.
 >
 > Is DebNr the name of a label instead of the intended
 > textbox, by any chance?

Thanks for the suggestions.
Unfortunately it's not yet solved.

When running a breakpont the results are ;
DebNr.DefaultValue = ""
Forms!FrmStam!DebNr = "01AAA01" ; This is as it should be.

I have also changed the textfield in DebiteurNr, which gave an error in my
vb-code. After changing the code the form opened with the same error.

Any further suggestions are more then welcome.

Thanks again.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: New record with data from other form 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> Visual Basic All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]