It must be easy to resolve

bhaycox

New member
Local time
Today, 08:36
Joined
Feb 2, 2008
Messages
9
Hi,

I have a simple database to output letters. I use 1 form to capture client data and then output this to a number of reports I have set up. It all runs off a single table I created.

One of the fields (Extra Info) is only used rarely and therefore I didn't want to put it on the main form. So I created another form with the memo input box on it and had a button from the main form to access it.

Here's my issue which I'm sure must be easy to resolve:

If I'm inputting data to record#5 and I need to add 'Extra Info' I hit the button, it brings up the Extra form but it loads at record#1. How do I get t load at the current record?

Thanks in advance - it's been years since I've even looked at Access so please be as simplistic as possible with your replies.

Cheers

Ben
 
Hi Ben

The way you have worded your question makes me suspicious that you don't have a primary key. You need a primary key to uniquely identify each record in your table. The record number you see in your form does not do this in any way. The record number on the form iss purely the sequence number of that particular record set (which can easily change e.g. if you change the sort order)

Furthermore, if you try to open another form at exactly the same record then you might get some problems with record locking. It's possible to get round this. However, have you considered using the Tab control.

The Tab control is a powerful tool allowing you much more space on your form and also conveniently hides fields. Your main data fields can be put on the first tab and any extra data fields on a second tab. In practice you might want to go futher by setting each tab for certain categories of data e.g. tab1= Personal details, Tab2=car details etc.

hth
Chris
 
Hi Stopher,

I do have a Primary Key it's just an auto number in the first field.

I hadn't thought of tabs I'll have a look at using them, but I did like the idea of having a pop up on command form to enter the Extra Info.

Thanks

Ben
 
DoCmd.OpenForm "frmExtraInfo", acPreview, , _
"AutonumberID = Forms!frmMainForm!AutonumberID"?
 
DoCmd.OpenForm "frmExtraInfo", acPreview, , _
"AutonumberID = Forms!frmMainForm!AutonumberID"?

Cheers ahuvas,

where do I put this code? On the form I'm opening? I did that and it opened it in a report.

What have I done wrong?

Ben
 
No place it on the on click event on the button on the main form that causes the second form to open.
 
Did it work? Wooho that was my first good/helpful piece of advice on this board to do with VBA :) although I am sure someone here is sure to tell me I am full of it. See one, do one, teach one :)
 
Last edited:

Users who are viewing this thread

Back
Top Bottom