473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a new record in a form problem

5 New Member
I have a master form (clients), and 2 subforms (invoice and credit account details). This all works great.
ive added a command button in the master form (clients) to open a new form as a popup where i can view information about the credit payment history, when i created the command button i used the "open the form and find specific data to display" option, i then linked the new form to only display data that is relevent to the master form(clients) data currently displayed. Again this works fine, the popup form only shows these filtered records.
My problem is, when i goto add a new record all the filtering is lost and i have to use the combo box, with its list of names, to get the relevent client name again, i knew it would do this, but what i dont know is how can I force the combo box to display the clients name that is being used on the filtered popup form.
It realy has me stumped, i dont want to take the chance that the end-user puts in the wrong client name.
Any help would be well appreciated, and i can then get a good nights sleep.
Feb 21 '07 #1
6 2315
Rabbit
12,516 Recognized Expert Moderator MVP
I suppose you can extract the client name that is being used in the filter and use that to fill in the name for your new record. You could also lock the field to prevent people from tampering with it.
Feb 21 '07 #2
paulcrowsnest
5 New Member
Cheers Rabbit, although i do a fair bit of VB etc in web design ASP.net, i am quite new to Access, and i have found lots of info on the net to help me along, but again, my problem is that when you say extract the filtered name from the form, i go derrrr, what does that mean and how do i do that, if you could expand on that statement i would be grateful. i will look tho to see if i can figure it out based on your comments, cheers
Feb 22 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Well, if there is a filter on the form. Then the form's Filter property will have the string statement that filter's it. Something along the lines of:
Expand|Select|Wrap|Line Numbers
  1. Filter = ((tbl_Data.[Client Name] = "Bob"))
You should be able to pull that substring out, i forget the exact function.
Feb 22 '07 #4
NeoPa
32,557 Recognized Expert Moderator MVP
Well, if there is a filter on the form. Then the form's Filter property will have the string statement that filter's it. Something along the lines of:
Expand|Select|Wrap|Line Numbers
  1. Filter = ((tbl_Data.[Client Name] = "Bob"))
You should be able to pull that substring out, i forget the exact function.
If your filter (Me.Filter) is of the form described by Rabbit, then some code along the lines of the following should extract the value out of it. I'm searching for the (") char (Better to use (') in SQL strings though) and using its positions to formulate the string.
Expand|Select|Wrap|Line Numbers
  1. Dim strName As String
  2. Dim intQPos As Integer
  3.  
  4. intQPos = InStr(1,Me.Filter,"""")
  5. strName = Mid(Me.Filter,intQPos)
  6. intQPos = InStr(1,strName,"""")
  7. strName = Left(strName,intQPos-1)
Feb 23 '07 #5
paulcrowsnest
5 New Member
Thanks guys for the help, sorry for the delayed response, been away (got Married :(

Because the subform is linked to the mainform via ClientID i found that if i present the subform with "Data-Allow Additions" set to True it automatically inserted the ID into the subform for me i then just added the other data fields and added the new record, i stumbled on it by accident on another form i was working on, it seems to do what i want.
thanks again for your assistance, it is appreciated
Mar 11 '07 #6
NeoPa
32,557 Recognized Expert Moderator MVP
Thanks guys for the help, sorry for the delayed response, been away (got Married :(

Because the subform is linked to the mainform via ClientID i found that if i present the subform with "Data-Allow Additions" set to True it automatically inserted the ID into the subform for me i then just added the other data fields and added the new record, i stumbled on it by accident on another form i was working on, it seems to do what i want.
thanks again for your assistance, it is appreciated
No problem - glad you found a good solution.
Congratulations on your nuptials btw :)
Mar 11 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1808
by: Mike | last post by:
I have a form that certain information on it. On this form there is a button that opens a payment form. When the payment form opens I enter a payment type, check cash charge, payment number,...
7
1324
by: Mathew Hill | last post by:
I am a beginner to the more technical aspects of Microsoft Access (2000) and was wondering if any one can help. I have 3 buttons on a form which add, delete and search for a record. However, when I...
6
2496
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
2
5760
by: brenda.stow | last post by:
error msg " An error occured while referencing the object. You tried to run a visual basic procedure that improperly references a property or method of an object" This msg occurs everytime I add a...
3
4855
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
8
3261
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
7
1981
by: Ron | last post by:
Hi All, Using Access2000, winXP. Table 1 = tblClients displayed on frmClients via qryClients. 2nd table = tblInvoices shown on frmInvoices via qryInvoices. 2nd table = tblDetails shown on...
1
2620
by: ConfusedMay | last post by:
Hi, I'm working on a database that has a form which hold all of our products testing. each product can hold more than 1 complete test (complete test here means that product has to have before and...
1
1450
by: raaaz | last post by:
Hi dears, I am adding a record in Access database using AddNew method of recordset. here is the code of the page .. <% Set RsLibBuild = Server.CreateObject ("ADODB.Recordset")...
1
1617
by: raaaz | last post by:
Hi All, I am having a totaly different sort of problem which is out of my efforts now so may be any one out of you might help me out of this. I am using very simple code below to add a record...
0
7199
marktang
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,...
0
7074
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...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.