Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My question is about re-displaying a form. I have a form (sales) I input
some data and then save it. I then add a new record, some of the data on the
first form is the same. So I first update the fields that are the same. The
problem is I don't know how to redisplay the form. Can someone please tell me
how to redisplay a form??
Thank you.
 
What do you mean by redisplay the form?
Once you open the form, it displays until you close it or hide it.
Can you be more specific, please?
 
You are correct about open form. What I really mean is, I created a new
record in the data table and would like to display the new record. When I
open the form what I get is the first record in the data table. example:

DoCmd.GoToRecord , , acNewRec

Me![bidnumber] = bidnumber
Me![jobname] = jname
Me![city] = jcity
Me![state] = Jstate
Me![owner] = jowner
Me![Architect] = JArch
Me![engineer] = Jeng
Me![bid-type] = jbtype
Me![bid-priority] = jbpri
Me![bid-date] = jbdate
Me![start-date] = jsdate
Me![building-size] = jtsize
 
That is the way it works. When you open a bound form, the first record is
displayed. The first record is defined as either the natural order of the
form's record source or if you are using a query, any sort order at the query
level, or the order by property of the form object.
If you are entering the data in the form, that should not be an issue.
If you are entering data directly into the table, why?
If you are entering data into the table, it will not show up until either
you close and open the form or when you requery the form.
--
Dave Hargis, Microsoft Access MVP


nbohana said:
You are correct about open form. What I really mean is, I created a new
record in the data table and would like to display the new record. When I
open the form what I get is the first record in the data table. example:

DoCmd.GoToRecord , , acNewRec

Me![bidnumber] = bidnumber
Me![jobname] = jname
Me![city] = jcity
Me![state] = Jstate
Me![owner] = jowner
Me![Architect] = JArch
Me![engineer] = Jeng
Me![bid-type] = jbtype
Me![bid-priority] = jbpri
Me![bid-date] = jbdate
Me![start-date] = jsdate
Me![building-size] = jtsize

--
Norm Bohana


Klatuu said:
What do you mean by redisplay the form?
Once you open the form, it displays until you close it or hide it.
Can you be more specific, please?
 
My question is about re-displaying a form. I have a form (sales) I input
some data and then save it. I then add a new record, some of the data on the
first form is the same. So I first update the fields that are the same. The
problem is I don't know how to redisplay the form. Can someone please tell me
how to redisplay a form??
Thank you.

This is a bit confusing!

Data is *NOT* stored in Forms. A Form is just a window, a tool to let you see
and edit data stored in a Table. "Redisplaying" a form can be done by
navigating to a previously entered record, but that doesn't seem to be
relevant to what you want to do.

Would it help if various fields were to default to the value entered in the
previous record? That can be done by using the AfterUpdate event of each
control bound to such a field to set that control's DefaultValue property:

Private Sub txtSomefield_AfterUpdate()
Me!txtSomefield.DefaultValue = Chr(34) & Me!txtSomefield & Chr(34)
End Sub

The DefaultValue property must be a String so the code inserts " marks before
and after.

John W. Vinson [MVP]
 
Hi John, I understand that data is not stored in forms, my termology was bad.
I will try and be better. My application describs shoping centers that have
one or more buildings. In the sales form I input data about building 'A'. I
then I have a button that add a building to the shopping center, some of the
data is the same for all buildings (i.e Owner, Location and etc..). So I add
a new record to the data table, and put the common data into the table and
save it. At that time I would like to display that record so I can complete
the building info. I use the following command to display the data:

DoCmd.OpenForm stDocName, acNormal, , , , acWindowNormal

This works a little (a few fields are there but not all)! if I do 'previous
record' the data is there and is correct. I hope that this is a better
explication. Please help, and thanks for your comments.
 
Hi John Thanks for the response. I tried your examples and here is what
happened. First the 'bid-number' is a number, and the 'bid-suffix' is text.

stLinkCriteria = "[bid-number]= " & bnum & "And [bid-suffix]=" & bsuffix

When I ran this code I got a box that ask 'Enter Parameter Value'. When I
entered
the value the code worked just fine. Please advise and again thank you.
 
nbohana said:
Hi John Thanks for the response. I tried your examples and here is what
happened. First the 'bid-number' is a number, and the 'bid-suffix' is text.

stLinkCriteria = "[bid-number]= " & bnum & "And [bid-suffix]=" & bsuffix

When I ran this code I got a box that ask 'Enter Parameter Value'. When I
entered
the value the code worked just fine. Please advise and again thank you.


You need quotes around the text value:

. . . & "And [bid-suffix]=""" & bsuffix & """"

Note: To get one " in a quoted string, you need to use two "
 
Hi John Thanks for the response. I tried your examples and here is what
happened. First the 'bid-number' is a number, and the 'bid-suffix' is text.

stLinkCriteria = "[bid-number]= " & bnum & "And [bid-suffix]=" & bsuffix

When I ran this code I got a box that ask 'Enter Parameter Value'. When I
entered
the value the code worked just fine. Please advise and again thank you.

Text values need quotemarks - either ' or " - as delimiters.

Try setting stLinkCriteria to

"[bid-number]= " & bnum & " And [bid-suffix]='" & bsuffix & "'"

For clarity, that's

"[bid-number]= " & bnum & " And [bid-suffix]=' " & bsuffix & " ' "

Note that you need a blank before the word And - otherwise your query becomes

[bid-number] = 123And [bid-suffix]...

Blanks are meaningful delimiters!

John W. Vinson [MVP]
 
Sorry, John, I thought you were done for the day.
I didn't mean to confuse this thread with different
suggestions.
 
Back
Top